I want to edit my xml file

Question: Hi I am working on XML file, here I want to give rights to user to edit my xml file nodes to his own custom language.
I am enclosing my code, but it is not editting my xml file. Need assistance.
class Program
{
    static void Main(string[] args)
    {
        //The Path to the xml file
        string path = "D://Documents and Settings//Umaid//My Documents//Visual Studio 2008//Projects//EditXML//EditXML//testing.xml";

        //Create FileStream fs
        System.IO.FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

        //Create new XmlDocument
        System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
        //Load the contents of the filestream into the XmlDocument (xmldoc)
        xmldoc.Load(fs);
        //close the fs filestream
        fs.Close();
        //Change the contents of the attribute
        xmldoc.DocumentElement.ChildNodes[0].Attributes[0].InnerText = "Umaid";

        // Create the filestream for saving
        FileStream WRITER = new FileStream(path, FileMode.Truncate, FileAccess.Write, FileShare.ReadWrite);

        // Save the xmldocument
        xmldoc.Save(WRITER);
        //Close the writer filestream
        WRITER.Close();

    }
}

My XML file which I am going to edit, but couldn't.
    <?xml version="1.0" encoding="utf-8" ?>
<rule id="city" scope="public">
  <one-of>
    <item>Boston</item>

  </one-of>
</rule>

Answer: What do you really want to do with your XML?? Which attribute to you want to change??
One hint: you can load and save XmlDocument to a path directly - no need for the filestream .....
xmldoc.Load(@"D:\yourpath\file.xml");

xmldoc.Save(@"D:\yourpath\newfile.xml");

The problem is that your expression xmldoc.DocumentElement.ChildNodes[0] selects the <one-of> node which has no attributes.
You cannot change a non-existing attribute.
If you want to change the "id" attribute of <rule>, you need to do this on the DocumentElement:
xmldoc.DocumentElement.Attributes["id"].Value = "Umaid";

If you want to change the text inside the <item>, do this:
XmlNode itemNode = xmldoc.SelectSingleNode("/rule/one-of/item");
if(itemNode != null)
{
   itemNode.InnerText = "Umaid";
}

Marc
Answer: class Program
{
    static void Main(string[] args)
    {
        string path = "D:\\Documents and Settings\\Umaid\\My Documents\\Visual Studio 2008\\Projects\\EditXML\\EditXML\\testing.xml";
        XmlDocument doc = new XmlDocument();
        doc.Load(path);
        var itemNode = doc.SelectSingleNode("rule/one-of/item");
        if (itemNode != null)
        {
            itemNode.InnerText = "Umaid";
        }
        doc.Save(path);
    }
}

I want to edit my xml file


Evaluate $\lim _{x\to \infty }\left(\cos\sqrt{x}-\cos\sqrt{x-1}\right)$

Question: How should I determine the following limit?
$\lim _{x\to \infty }\left(\cos\sqrt{x}-\cos\sqrt{x-1}\right)$
Comment: @kishlaya Sorry but your "hint" is not understandable.
Comment: Hint: Consider all possible ways in which $x$ approaches $\infty$
Comment: @Did Oh! I meant like, consider case wise, $x = k^2, k^2 < x < (k+1)^2,...$. But nevertheless, I will try to come up with better explanations next time. My apologies.
Comment: @kishlaya And how is the condition $k^2<x<(k+1)^2$ helping? Maybe your hint was also wrong, not only difficult to understand.
Comment: @Did No, that's not a condition but a case analysis
Comment: @kishlaya Then, as I said, it is **wrong**. But if you want to explain what you mean by expanding this "hint" into a full answer, please do that, and if indeed your proof works, I will be delighted.
Answer: HINT
Use $\cos x - \cos y = -2 \sin(\frac {(x - y)} 2 ) \sin(\frac {(x + y)} 2 )$
Then $\lim _{x\to \infty }\sin(\frac {(\sqrt x - \sqrt {x-1})} 2 )=\lim _{x\to \infty }\sin(\frac 1 {2(\sqrt x + \sqrt {x-1})})=0$
Because $\sin(\frac {(\sqrt x + \sqrt {x-1})} 2) $ is bounded, it follows the limit is zero
Answer: The difference between $\sqrt{x}$ and $\sqrt{x-1}$ becomes arbitrary small as $x$ goes to infinity. Since $\cos$ is a uniformly continuous function, the difference between the cosine of two arbitrary close numbers is 0. So the limit is 0.
Uniform continuity is a stronger form of continuity. Having a bounded derivative is a sufficient condition for a function to be uniformly continuous.
This method requires some extra work to make a rigid proof, but it is a general method that works in many cases and it complies with intuition.
Comment: This answer, which provides the true insight why the limit is zero, is heavily downvoted, while at least two other answers, which rush to mostly irrelevant but explicit computations, are upvoted. Sorry but this is not something the site should be proud of.
Comment: @Did I agree. People downvoted without even bother to read the answer.
Comment: @egreg Yes. Fortunately the tide of votes was somewhat reversed since then.
Comment: @Did Also the content of this answer has been changed heavily
Comment: @EugenCovaci Yeah, and it was corrected *five minutes* later. Do you really think the downvotes accumulated during these five minutes? First, the only downvote remaining falls outside of this time span and second, that would be an excellent news if every instant voter on the site was fully aware of the mathematical reason why the first version was lacking an argument while the second version and the subsequent ones are not.
Answer: $$\cos\sqrt{x}-\cos\sqrt{x-1}=2\sin\frac{\sqrt{x}+\sqrt{x-1}}{2}\sin\frac{\sqrt{x-1}-\sqrt{x}}{2}=$$
$$=-2\sin\frac{\sqrt{x}+\sqrt{x-1}}{2}\sin\frac{1}{2(\sqrt{x-1}+\sqrt{x})}\rightarrow0$$
Answer: $\displaystyle  \lim_{x\rightarrow \infty}\bigg|\int^{\sqrt{x}}_{\sqrt{x-1}}\sin xdx\bigg| \leq \lim_{x\rightarrow \infty}\int^{\sqrt{x}}_{\sqrt{x-1}}1dx =  \lim_{x\rightarrow \infty}\left(\sqrt{x}-\sqrt{x-1}\right) =  \lim_{x\rightarrow \infty}\frac{1}{\left(\sqrt{x}+\sqrt{x-1}\right)}=0$
Comment: This proves that the $\limsup$ is $\le 0$. What about showing $\liminf \ge 0$?
Comment: You can use absolute value around the first integral.
Answer: Direct approach:
Let  $f(x) := \cos\sqrt{x} - \cos\sqrt{x - 1}$.
By the mean value theorem, for two values $a, b \in \mathbb R$, there exists $t\in\mathbb [a, b]$ such that $\cos(b) - \cos(a) = \cos'(t)(b - a)$. Thus,$$
|f(x)|=|\cos\sqrt{x} - \cos\sqrt{x - 1}| \\
=|\cos'(t)(\sqrt{x} - \sqrt{x - 1})| \\
=|-\sin(t)|\cdot|\sqrt{x} - \sqrt{x - 1}|\\
\le|\sqrt{x} - \sqrt{x - 1}| = \sqrt{x} - \sqrt{x - 1} =: g(x)$$
for all $x>1$.

Assertion: $\lim_{x\rightarrow\infty} g(x) = 0$.
Proof: Let $\epsilon > 0$. Then
$$g(x) \le \epsilon\\
\Leftrightarrow\sqrt{x} \leq \epsilon + \sqrt{x - 1}\\
\Leftrightarrow x \leq \epsilon^2 + 2\sqrt{x - 1} + x -1\\
\Leftrightarrow x \geq 1+(1-\epsilon^2)^2/4 =: x_0$$
Thus, for all $x> x_0$, we have $|g(x)| = g(x) \le \epsilon$.

Together with $|f(x)|\le g(x)$, this yields $\lim_{x\rightarrow\infty} f(x) = 0$.
Comment: This is the elaborated version of @Paul's answer http://math.stackexchange.com/a/2107266/408656
Comment: I just realized that $g(x) = 1/(\sqrt{x}+\sqrt{x-1}) \rightarrow 0$, so the second part is more or less obsolete.
Comment: @egreg Thanks, you're right


Solving equations of the form $\sin (f_1(x)) = \alpha \sin(f_2(x))$ for linear $f_1$ and $f_2$, with $0<\alpha<1$

Question: I wish to solve an equation of the form,
$$\sin (f_1(x)) = \alpha \sin(f_2(x))$$
where $f_1$ and $f_2$ are given and linear, and $0<\alpha<1$ .
This came up in an analysis of triangulating one's position with respect to three stationary beacons.
Any help would be appreciated.
Comment: Can you give an example of coefficients in $f_1,f_2$? What general solution procedure do you envision? Most numerical packages have root-finders for scalar equation, what are your obstacles in applying them?
Answer: Suppose $f_1(x) = a_1x + b_1, f_2(x) = a_2x + b_2$. Let $$g(x) = \sin(a_1x + b_1) - \alpha\sin(a_2x + b_2)$$
You are looking for points where $g(x) = 0$. Newton's method is useful for this.
$$g'(x) = a_1\cos(a_1x + b_1) - a_2\alpha\cos(a_2x + b_2)$$
The iteration equation is
$$x_{n+1} = x_n -\frac{\sin(a_1x_n + b_1) - \alpha\sin(a_2x_n + b_2)}{a_1\cos(a_1x_n + b_1) - a_2\alpha\cos(a_2x_n + b_2)}$$
Start with an initial guess, such as $x_0 = 0$, and it will take only a few iterations for it to settle down on a root of $g(x)$.


R linear regression categorical variable "hidden" value

Question: This is just an example that I have come across several times, so I don't have any sample data. Running a linear regression model in R:
a.lm = lm(Y ~ x1 + x2)

x1 is a continuous variable. x2 is categorical and has three values e.g. "Low", "Medium" and "High". However the output given by R would be something like:
summary(a.lm)
              Estimate Std. Error t value Pr(>|t|)
(Intercept)   0.521     0.20       1.446   0.19
x1            -0.61     0.11       1.451   0.17
x2Low         -0.78     0.22       -2.34   0.005
x2Medium      -0.56     0.45       -2.34   0.005

I understand that R introduces some sort of dummy coding on such factors (x2 being a factor). I'm just wondering, how do I interpret the x2 value "High"? For example, what effect does "High" x2s have on the response variable in the example given here?
I've seen examples of this elsewhere (e.g. here) but haven't found an explanation I could understand.
Comment: You may get a good answer here, but I'm going to flag this for migration to stats.SE, as the answer to this question essentially boils down to understanding how linear regression works.
Comment: I won't provide an answer here, because the question will be moved. But you can try a few things to understand what's going on: 1. run lm( Y ~x1 + x2 - 1). the "-1" will remove the intercept. 2. use relevel to change the reference category of x2.
Comment: You shouldn't need to do anything. I flagged it, but it may take an hour or two before a mod gets to it, it being a Sunday and all.
Comment: Yeah that's fair enough. Would it be better if I deleted it and moved it myself? Or is that unnecessary?
Answer: Q: " ... how do I interpret the x2 value "High"? For example, what effect does "High" x2s have on the response variable in the example given here??
A: You have no doubt noticed that there is no mention of x2="High" in the output. At the moment x2High is chosen as the "base case". That's because you offered a factor variable with the default coding for levels despite an ordering that would  have been L/M/H more naturally to the human mind. But "H" being lexically before both "L" and "M" in the alphabet, was chosen by R as the base case.
Since 'x2' was not ordered, each of the reported contrasts were relative to x2="High" and so x2=="Low" was  estimated at -0.78 relative to x2="High". At the moment the Intercept is the estimated value of "Y" when x2="High" and x1= 0. You probably want to re-run your regression after changing the levels ordering (but not making the factor ordered).
x2a = factor(x2, levels=c("Low", "Medium", "High"))

Then your 'Medium' and 'High' estimate will be more in line with what you expect.
Edit: There are alternative coding arrangements (or more accurately arrangements of the model matrix.) The default choice for contrasts in R is "treatment contrasts" which specifies one factor level (or one particular combination of factor levels) as the reference level and reports estimated mean differences for other levels or combinations. You can, however have the reference level be the overall mean by forcing the Intercept to be 0 (not recommended) or using one of the other contrast choices:
?contrasts
?C   # which also means you should _not_ use either "c" or "C" as variable names.

You can choose different contrasts for different factors, although doing so would seem to impose an additional interpretive burden. S-Plus uses Helmert contrasts by default, and SAS uses treatment contrasts but chooses the last factor level rather than the first as the reference level.
Comment: That makes sense. I suppose obviously `x2` couldn't have "no value" since it must be one of "High", "Medium" or "Low".  Thanks for your answer.


right handed bass into left handed bass

Question: I can't easily find a left handed bass guitar. Can I restring the bass to be for a leftie (reverse the ordering of the strings)?
I think that you can do this with an electric guitar, for sure with an accoustic guitar.
Comment: Not sure if this is a possibility to you, but I'm a lefty, and I play guitar/bass right-handed.  Just feels more natural to me.  My left hand does the fancy fingering stuff, and my "dumb" right hand just grabs strings and yanks on them.
Comment: @Pulsehead hey, same for me! When I started, my teacher recommendet it, and I can't be happier about that decision. I also feel the same about my right hand tho
Answer: Sure, of course you can.  But getting it to playable condition won't be quite so simple.  You'll have to re-adjust the bridge to account for the fact that the thickest string is now located where the thinnest string was, and vice-versa.  If you don't feel comfortable doing this yourself (although it's pretty easy), any competent guitar tech will do it for around $25 or so.
Depending on the pickups on your bass (I'm thinking of P-pickups in particular), you'll get a slightly different sound than you would have gotten if you hadn't restrung it.  This isn't a bad thing, just something to be aware of.  You may also have to adjust the pickup heights, for the same reasons that you'll want to adjust the bridge.
Finally, the ergonomics of the bass will be a bit strange.  Your left forearm will rest near where the knobs are, the formerly-upper-now-lower bout of the bass will restrict access to the upper frets, etc.  None of this is a deal-breaker, but you may find it a bit awkward at first.  If you haven't yet purchased a bass, you might want to try several different models in your preferred playing position to see if any of them feel more physically comfortable.
You say you think this can be done with electric guitar, and of course you're right: Jimi Hendrix played right-handed Strats that he re-strung, turned upside down, and played left-handed.  If the greatest guitar virtuoso ever can get by playing right-handed guitars left-handed, so can you.
Comment: It's in another answer, but you'd have to reverse the nut as well to accommodate the reverse string order.  It's also worth while to just refer to some bass players like Jimmy Halsip of the Yellow Jackets.  He just flipped it around, and didn't bother changing the order.
Answer: If everything else is OK (what the other answer talks about), you would need to reverse the nut if possible or get a new one.  The larger strings won't fit into the grooves for the smaller ones, and the small strings will be too lose in the large grooves.
Comment: But if i do that, wont the balance be out? will i get major neck dive or something?
Comment: neck dive from flipping one small piece? I don't think so.
Answer: Just a shout out to all those left handed players  playing a right handed  bass upside-down. Never give up fellas! It can be done.
Two years ago, I bought a second hand right handed ASHTON Bass and an 80 watt amp. I've never played Bass before and being left handed I thought I'd just have a bit of fun.
Two years later? - I have 50 plus songs under my belt, and am self taught.
The biggest issue for me? - I've tried a left handed bass after all that time and I can't play a bloody thing! So what I'm looking at is  finding a left handed bass - but strung right handed  (sounds strange I know ).
For those of you that play left handed on a right handed bass, when people smirk and giggle at you for putting it on upside-down - I always use this one liner on them "The only time you need to laugh is if the music come out up-side down." That usually shuts them down pretty quick.
But never, ever give up guys! Music has no "rules" and no "conformity" it's all about playing what you feel the way you play it is nobody else's business but yours. There's no right and wrong, there's only "the sound".
Comment: Only change was the strap button, right? Does it feel balanced?
Answer: I know this is an old post by now, but thought I'd share my experience. I play left-handed guitar, but play right-handed basses left-handed (upside-down, if you will).
As someone else said, playing upside down can be done - much more easily on bass than on guitar in fact, as you're using less complex finger shapes (but playing slap is tougher, though not impossible). Other than the controls & jack being near your left hand and easier to knock accidentally, the main issues arise when you're using a bass with offset shoulder horns: your access to the top frets will be limited by the depth of the cutout, as the deeper one is now at the top; also, if you leave the strap button where it is, the strap is going to cut across the back of the neck, further limiting fret access; and if you move the strap button to the shorter horn, you're then moving the centre of balance and you'll have the neck dipping. This isn't a huge issue with guitars (although there's an unconvincing theory that it exacerbated Kurt Cobain's scoliosis), but I've learned the hard way that it's definitely more pronounced with bass, due to the longer and heavier neck & headstock. The best option there is maybe to go for a symmetrical bass, or one with the strap button directly behind the neck, like an SG.
If you want to re-string a right-handed bass left-handed you'll be dealing with the problems above, you'll need to set up the bridge and pickups as suggested, and you'll also probably want to change the nut. Personally, I'm so used to playing upside down that I'd want to go the other way and re-string a left-handed bass right-handed, but I'm reluctant to spend a lot on a decent lefty and start messing with the nut, etc. as the resale market for that setup would be tiny :)
Answer: you can flip it, as observed above, make sure that you get a new nut cut as the RH nut wont do but also consider that not all brands have E strings that are long enough to reach the furthest machine head. Additionally that you may not get enough break angle over the nut (due to the gentle slope from nut to G machine head) to avoid buzzing.
Where do you live?  I've always found it quite easy to find LH models. Flipping is probably more trouble than its worth.

right handed bass into left handed bass


Inverse of Roto-Translation Matrix

Question: I'm trying to implement two JavaScript functions to calculate

A 2D coordinate transformation from the reference frame $O$ to $O'$;
The inverse transformation from $O'$ to $O$;

The first step it's very simple for me and it works. My mathematical process is this:
$$
  \begin{pmatrix}
    x'\\
    y'\\
    1
  \end{pmatrix}
=
  \begin{pmatrix}
    R & u_0\\
    0 & 1
  \end{pmatrix}
  \begin{pmatrix}
    u\\
    0
  \end{pmatrix}
=
  \begin{pmatrix}
    cos\theta & -sin\theta & x_0\\
    sin\theta & cos\theta & y_0\\
    0 & 0 & 1
  \end{pmatrix}
  \begin{pmatrix}
    x\\
    y\\
    1
  \end{pmatrix}
$$
Where $R$ is the rotation matrix, $u_0$ is the $O'$ origin in the $O$ frame reference and $u$ is a point in $O$. At the end I get this two equations:
$$
\left\{
\begin{array}{c}
    x' = xcos\theta - ysin\theta + x_0\\
    y' = xsin\theta + ycos\theta + y_0\\
\end{array}
\right.
$$
The problem is how to calculate the inverse transformation. I'm doing something like this but it doesn't work:
$$
  \begin{pmatrix}
    x\\
    y\\
    1
  \end{pmatrix}
=
  \begin{pmatrix}
    R^{-1} & -R^{-1}u_0\\
    0 & 1
  \end{pmatrix}
  \begin{pmatrix}
    u'\\
    0
  \end{pmatrix}
=
  \begin{pmatrix}
    \frac{1}{cos\theta} & sin\theta & -\frac{x_0}{cos\theta}-y_0sin\theta\\
    -sin\theta & \frac{1}{cos\theta} & {x_0}{sin\theta}-\frac{y_0}{cos\theta}\\
    0 & 0 & 1
  \end{pmatrix}
  \begin{pmatrix}
    x'\\
    y'\\
    1
  \end{pmatrix}
$$
The final equations are:
$$
\left\{
\begin{array}{c}
    x = x'\frac{1}{cos\theta} + y'sin\theta -\frac{x_0}{cos\theta}-y_0cos\theta\\
    y = -x'sin\theta + y'\frac{1}{cos\theta} + {x_0}{sin\theta}-\frac{y_0}{cos\theta}\\
\end{array}
\right.
$$
Can you tell me where I wrong?
Comment: $\det R = cos^2\theta + sin^2\theta = 1$. Hence,

$
R^{-1} =
\begin{pmatrix}
cos\theta & sin\theta \\
-sin\theta & cos\theta
\end{pmatrix}.$
Answer: Pay attention to what transformation you want to represent, whether active or passive.
Anyway, if $R$ is the matrix that represents a rotation of angle $\theta$ in a plane, its inverse is the matrix that represents a rotation of the opposite angle $- \theta$, around the same origin, and it is easy to see that it is represented by the transpose matrix: $R^{-1}=R^T$ (it seems that this is your mistake, when you use $\frac{1}{\cos \theta}$ in the inverse matrix.).
From this it is also easy to see that the inverse  of a rigid tranformation $T$ that , in homogeneous coordinates, is represented by the matrix
$$
T=\begin{pmatrix}
R&\vec u\\
0&1
\end{pmatrix}
$$
is represented by the matrix
$$
T^{-1}=\begin{pmatrix}
R^T&-R^T\vec u\\
0&1
\end{pmatrix}
$$

Inverse of Roto-Translation Matrix


Windows 8 Hyper-V & VLANs

Question: I'm trying to setup Windows 8's Hyper-V so that I have:

Switch which has 2 VMS connected to it
Vyatta box which is connected to said switch and set as trunk (native vlan 1, allowed vlans 1-4000)
Windows 2008 R2 server with access vlan 2002

I have created said VMs and both are conncted to same switch. I have used following commands from PowerShell to set Vyatta's network interface to trunk mode:

$z = (Get-VMNetworkAdapter -VMName vyatta)[1]
Set-VMNetworkAdapterVlan -VMNetworkAdapter $z -Trunk -NativeVlanId 1 -AllowedVlanIdList 1-4000
Get-VMNetworkAdapterVlan
VMName                       VMNetworkAdapterName Mode     VlanList
------                       -------------------- ----     --------
                             swname               Untagged
windowsvm                    Network Adapter      Access   2002
vyatta                       Network Adapter      Trunk    1,1-4000

As far as I understand VLANs and Hyper-V, this should be everything I need to do. However, it seems like strips the tag and replaces it with native VLAN's tag.
When doing capture on said interface on Vyatta (tcpdump -s0 -XX -nnpi eth0), the ARP packet which arrives from Windows machine looks like following:

11:26:50.908865 ARP, Request who-has 10.16.32.1 tell 10.16.32.2, length 28
        0x0000:  ffff ffff ffff 0015 5d01 dc03 0806 0001  ........].......
        0x0010:  0800 0604 0001 0015 5d01 dc03 0a10 2002  ........].......
        0x0020:  0000 0000 0000 0a10 2001                 ..........

Note 0x000C-x000F that shows 0001 (VLAN ID = 1) instead of 07d2 (VLAN ID = 2002).
I also noticed that if I change AllowedVlanIdList so that it doesn't include 2002, I will no longer see the ARP request.
Anyone know how I could force Hyper-V to keep the tag or is this a limitation on W8 Hyper-V?
Answer: I'm not sure if Windows Server 2008 R2 supports the network set up you've used there, neither in Virtual Machine Manager 2008 R2 nor in Hyper-V Manager on 2008 R2 do I see how to set VLAN trunking on a per-virtual machine level. In my set up, per Virtual Machine Manager 2008 R2's network configuration, I see this:

On the switch, I have VLAN 1 set as the primary (untagged) and everything else tagged and the switch ports for the server set to trunk. I then set up my Vyatta box so that it has a single NIC per VLAN I wanted to access, I was never able to set up a trunk on the VLAN and the management for the VM seem to indicate that it's not possible in 2008 R2, and I'm not sure if it's actually implemented for it.
I do know that the Set-VMNetworkAdapterVlan PowerShell cmdlet was added in the WMF 3.0 management pack, which is advised not to be installed on 2008 R2 currently because it was released with serious issues. (WMF 4.0 is slated to be released soon and resolve those problems, I believe.) It might be possible that the cmdlet you're using to set the Vyatta VM's network adapter to trunked mode isn't fully implemented on 2008 R2. I've never seen a VM configured in trunked mode myself.
Alas, I do not have a 2012 setup with Vyatta and Wireshark to test your setup.
Answer: Set NativeVlanId to 0
It should work then.

Windows 8 Hyper-V & VLANs


Hidden nginx rewrite rule (I think)

Question: About a week ago, I was playing with nginx rewrite stuff to rewrite /admin to https.
I now want to undo this, but I cannot for the life of me, remember where I put that rewrite rule.
I've reloaded, restarted, stopped and started nginx. I've rebooted the server. I've restored nginx.conf to the default version.
I have no idea where I put that rule. It's either there, or nginx is just confused, because when I go to [domain]/admin, it redirects to https://[domain]/admin
I might end up purging nginx from the system and installing from scratch.
Is there anywhere else that a rewrite might be put?
Any suggestions?
Thanks.
Answer: Perhaps you could provide your actual configuration file? You want to look for the include directive as that's the only way any directive can be "hidden".
Of course, far more likely is that your browser is caching and you've actually already removed the rewrite. Try to test the URL with curl and see if a location header is present, if not then it's browser caching.
Answer: You might have put it into default.conf, which is included by a vanilla nginx.conf and extends it.
Sounds like it because you restored nginx.conf and the behavior was the same.

Hidden nginx rewrite rule (I think)


Convolution of Two i.i.d. Exponential Distributions

Question: I have $X,Y$ random variables, both equally distributed under the exponential distribution. However, for some reason the convolution seems to vanish:
$$Z = X+Y $$
Therefore,
$$f_Z := \int_{0}^{x}f_X(x-t)f_Y(t)dt  $$
$$f_Z = \alpha_1\alpha_2\frac{e^{-\alpha_1 x}-e^{-\alpha_2 x}}{\alpha_1-\alpha_2},\hspace{6mm} \alpha_1 = \alpha_2 $$
The Algebra behind the convolution says $Z$ vanishes. But I don't find any intuitive reason on why this happens.
Comment: [Gamma Distribution out of sum of exponential random variables](https://math.stackexchange.com/questions/655302/gamma-distribution-out-of-sum-of-exponential-random-variables), https://math.stackexchange.com/q/474775/321264, https://math.stackexchange.com/q/2259027/321264
Answer: You have done your algebra incorrectly. In your answer you are dividing by zero (which I might add doesn't mean the convolution vanishes as you say). Also, you didn't mention it, but I'm also going to assume $X$ and $Y$ are independent (otherwise you can't just take the convolution of the respective pdfs). The exponential distribution has pdf $$f(x) = \begin{cases}
\lambda e^{-\lambda x}, & x\geqslant 0 \\
0, & x<0 .
\end{cases} $$ Hence, if $x>0$ then \begin{align*}
\int_{-\infty}^\infty f(y)f(x-y) d y &= \lambda^2\int_0^x e^{-\lambda y}e^{-\lambda(x-y)} d y \\
&= \lambda^2\int_0^x e^{-\lambda x} d y = \lambda^2 x e^{-\lambda x}.
\end{align*} If $x<0$ then $$ \int_{-\infty}^\infty f(y)f(x-y) d y = 0.$$ Thus, $$
f_Z(x) = \begin{cases}
\lambda^2 x e^{-\lambda x}, & x\geqslant 0 \\
0, & x<0.
\end{cases}
$$ This is nonzero.
Comment: whoops, I forgot about the Gamma distribution. Thank you so much.
Comment: I have provided a different solution.
Answer: Another way is to "re-cycle" your result which, btw, should have been:
$$f_Z = \alpha_1\alpha_2\frac{e^{-\alpha_1 x}-e^{-\alpha_2 x}}{\alpha_2-\alpha_1}$$
(otherwise, you have a negative valued density).
Here is how: setting $\alpha_2=\alpha_1+\epsilon$ and making $\epsilon$ tend to $0$, for a fixed $x$, we get:
$$\lim_{\epsilon \to 0} f_Z(x) = \lim_{\epsilon \to 0}\alpha_1(\alpha_1 + \epsilon)\frac{e^{-\alpha_1 x}-e^{-(\alpha_1+\epsilon) x}}{(\alpha_1+\epsilon)-\alpha_1}=-\alpha_1^2\lim_{\epsilon \to 0}\frac{e^{-(\alpha_1+\epsilon) x}-e^{-\alpha_1 x}}{\epsilon}$$
We recognize in this limit the derivative of $e^{- \alpha_1 x}$ with respect to $\alpha_1$ (in particular, $x$ is viewed as a constant) giving back the desired density:
$$(-\alpha_1^2)(-xe^{- \alpha_1 x})=\alpha_1^2xe^{- \alpha_1 x}$$


delete_if returning undefined method `include?' for nil:NilClass

Question: Not sure why this is happening, I'm just using the method how I see it here: delete_if
But obviously I'm doing something wrong, just can't tell what.
This is my code:
non_enabled_speeds = ["Expedited", "Standard"]

parsed_rates = [{:service_name=>"Expedited",
  :service_code=>"XYZ", :total_price=>800, :currency=>"USD"},
  {:service_name=>"Priority", :service_code=>"PYT",
:total_price=>1300, :currency=>"USD"},
  {:service_name=>"Standard", :service_code=>"XYZ",
:total_price=>500, :currency=>"USD"}]

non_enabled_speeds.each do |non_enabled_rate|
  parsed_rates.delete_if
{|rate| rate[:speed].include?(non_enabled_rate)}
end

I understand that delete_if uses include? under the covers, but I'm not sure why I'm getting this error:
undefined method `include?' for nil:NilClass

Comment: your rates don't have value for `:speed`
Comment: good lord.. need more coffee.. thanks
Comment: Ruby is an object oriented language, not an Arrays-of-Hashes-of-Strings oriented language. I suspect you would find this much easier to code and debug if you defined some classes to handle this data - e.g. `Rate`.
Answer: Nope, it's not about delete_if. One (or more) of your rate[:speed]s is nil.
{|rate| rate.fetch(:speed, []).include?(non_enabled_rate)}

Comment: More like ALL of them :)
Comment: arghhhhh.. sorry for the post.. not enough coffee!!
Comment: Oops, I did not check the array :D


What is the standard notation for a set of equivalence classes?

Question: What is the standard notation for a set of equivalence relations? Specifically, I have a pair of objects, call them $x$ and $y$ and I denote the ordered pair as $\left(x,y\right)$. I have a set of equivalence relations such as:
$\left(x,y\right) \sim \left(x^{-1},y\right) \sim \left(x,y^{-1}\right) \sim \left(y^{-1},x^{-1}\right)$
I would like to write this compactly, but I'm unsure of what the standard notation would be. Is the following appropriate?
$\left\{\left(x,y\right),\left(x^{-1},y\right),\left(x,y^{-1}\right),\left(y^{-1},x^{-1}\right)\right\}$
Comment: I think the usual way is to write just what you have written (perhaps followed by "$\forall x, y \in G$"), and say the quotient is $G/\sim$.
Comment: This question is very unclear. The title asks for notation for *a set of equivalence classes*, the first sentence talks about *a set of equivalence relations*. Then it apparently says that $(x,y) \sim (x^{-1},y) \sim (x, y^{-1}) \sim (y^{-1}, x^{-1})$ is *a set of equivalence relations*, and I now I have no longer any idea what that might be supposed to mean.
Answer: You can represent an equivalence class by using a representative from the class, and denoting the entire class by, say, $[(a, b)]$: this represents the set of all ordered pairs $(x, y)$ such that $(x, y) \sim (a, b)$.
So, for a given equivalence relation denoted by $\sim$: one of its equivalence classes can be denoted:
$$[(a, b)] = \{(x, y)\mid (x, y) \sim (a, b)\}$$
If there are many equivalence classes determined by an equivalence relation, and you want to denote the set of equivalence classes, you can list the equivalence classes as elements of a set:

$\{[(a, b)], [(c,d)], [(e, f)], \cdots [(y, z)]\}$ if there is a finite set of them.
For example, the set of equivalence classes determined by the equivalence relation of congruence modulo $4$ on the set of integers, you could write $\{[0], [1], [2], [3]\}$,
or, in the case of an infinite number of equivalence classes, like those corresponding to equality/identity on the natural numbers, one can write $\{[1], [2], [3], \cdots \}$.

If you are asking how to denote a set of different equivalence relations, where the elements of the set are relations, I'm not aware of the standard notation. (That's not to say it doesn't exist.)
Comment: What I want to do is have a way to denote the entire set of equivalence relations, like $P=\left\{\left(x,y\right),\left(x^{-1},y\right),\left(x,y^{-1}\right),\left(y^{-1},x^{-1}\right)\right\}$, so that I can later define the quotient set as $G/P$, so I need a way to denote the entire set of equivlanece relations not just one of them.
Comment: Try using square brackets to denote that the elements of $P$ are equivalence classes:$$ P=\left\{\left[\left(x,y\right)\right],\left[\left(x^{-1},y\right)\right],\left[\left(x,y^{-1}\right)\right],\left[\left(y^{-1},x^{-1}\right)\right]\right\}$$
Comment: @amWhy: Very nice answer +1
Answer: If $\sim$ is an equivalence class over $A$, then in many places we write $A/{\sim}$ as the set of equivalence classes.
This notation is similar, and on purpose, to the notation from algebra when writing $V/W$ for the quotient subspace, or $G/H$ for the quotient group, or $R/I$ when taking a quotient of a ring by an ideal.
The reason is that all those quotients actually induce an equivalence relation, and we have a natural structure on the set of equivalence classes.
Comment: @HoseinRahnama: Yes.
Comment: Is the notation trying to give the intuition that $A$ is divided by the relation $\sim$ into some equivalence classes?


Octaves start on C with guitar?

Question: I am learning scientific pitch in order to understand the guitar fretboard better, in terms of absolute pitch.
What I was taught, was that A to G, and then back to A up an octave.
When I look at the scientific pitch of the strings, I get this:

E2 A2 D3 G3 B3 E4

At first glance, it makes sense. But wait, B is above G?
The last three strings then become:
open, 1,   2,   3,   4,   5   (fret)
  G3, G#3, A4,  A#4, B4,  C4
  B3, C3,  C#3, D3,  D#3, E3
  E4, F4,  F#4, G4,  G#4, A5

This blows my brain, so on the fifth fret moving up you get

C4  E3  A5

How does this make logical sense? It goes down an octave yet higher in pitch?
Okay, now I realise like on piano that middle C is C4, and that is an easy reference (being roughly in middle, is the tonic of a scale that involves white keys etc. etc.) but is it really the first note in an octave in scientific pitch despite making sense only on a piano? Should I abandon scientific pitch for guitar and use 'real' octave (whatever that is!?)
In my computer programmer mind-set, where an index might start at 0 instead of 1 (okay, can get used to that), this is like an index starting at 3 and going up from there.
Comment: The [chroma feature](https://en.wikipedia.org/wiki/Chroma_feature) of a note will be the bridge between the programming and the musician mindset!
Comment: Your chart is not correct. The second line should be B3, C4,  C#4, D4,  D#4, E4 instead of B3, C3,  C#3, D3,  D#3, E3. So going up the frets goes up in pitch, without exceptions.
Comment: 6 upvotes for a question based on misrepresentation of octave numbering?!?
Answer: Yes, in the scientific notation (regardless of the instrument, of course it works on piano and everywhere else) the octaves start at C. So the order is: ... G3, G#3, A3, A#3, B3, C4, C#4, D4, D#4, E4 and so on.
(By the way, you could have easily found that on Wikipedia: Scientific pitch notation.)
I guess that you could have been tripped up by the fact that if you go A to G, the pitches are sorted alphabetically. This convention dates back to  the Middle Ages, and I think it was because they took the A natural minor scale as a reference for naming the pitches (but I'm no music historian). Today, for some reason, we take the major scale as a reference, so the octaves start with C.
Answer: In scientific pitch notation, the octave number increases each time you go up to, or past, another 'C'. In other words, the interval from B3 to C4 is only one semitone. This is true regardless of which instrument you are using.
One problem with your diagram is that you've numbered the open strings using this standard pitch notation (where the octave changes on C), but as you go up the frets, you've used your idea of the octave changing on A - you've mixed two systems.
If you actually go up an octave on C, as you should, the last three strings then become (in the layout of your diagram):
open, 1,   2,   3,   4,   5   (fret)
  G3, G#3, A3,  A#3, B3,  C4
  B3, C4,  C#4, D4,  D#4, E4
  E4, F4,  F#4, G4,  G#4, A4

And this is fine - A4 is higher than E4, which is higher than C4. Here is another larger diagram from this researchgate article, in a more conventional layout (with the strings ordered the other way):

(Even if you were wanting to use an alternative system where the octave number increased on A, your diagram is already wrong on the open frets, because G3 in 'your system' is actually higher than B3. But it's probably best not to dwell too much on an alternative system - the normal standard is to go up an octave number on C).

What I was taught, was that A to G, and then back to A up an octave.

That's true, and it's true for any letter name. E.g. if you go up from F up to the next F, that's also 'an octave'. In other words, an octave can start on any note at all. But when we say 'an octave' there, we just mean the interval of an octave, not the numbered octave in scientific pitch notation.
Answer: It's as simple as C>C. Defying logic somewhat, the numbers don't go from A>A, which we'd expect, but from C>C. So, for example, conecutive notes are A2, B2, C3,D3, E3, F3, G3, A3, B3, C4, D4 etc.
Bear in mind, though, that when you refer to the actual notes written on the treble clef, for guitar, they're written one octave higher than they sound. Also, scientific pitch is for any instrument - it refers to the pitch, not specifically to what an instrument may read or play.
So, the quoted scientific pitch names are correct. That does make B3 above G3, from my list. Accept it, warts an' all, or do like most of us, and be happy that 'middle C' is C4, and be done with it.

Octaves start on C with guitar?


SSL is breaking my htaccess file in WordPress

Question: My .htacess file is vital not only for redirection but for the look of the site. I'm not sure why the developers of this theme did this but I can't change that.
If you navigate to http://akcrossfit.com you'll see the site as it should be. When you navigate to https://akcrossfit.com you'll see the site without styling and any navigation leads to a 404 error.
Here is my .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^other/(.*) /wp-includes/$1 [QSA,L]
RewriteRule ^file/(.*) /wp-content/uploads/$1 [QSA,L]
RewriteRule ^ext/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteRule ^skin/main\.css //index.php?style_wrapper=1 [QSA,L]
RewriteRule ^skin/(.*) /wp-content/themes/richer-child/$1 [QSA,L]
RewriteRule ^richer/(.*) /wp-content/themes/richer/$1 [QSA,L]
RewriteRule ^skin_main/(.*) /wp-content/themes/richer/$1 [QSA,L]
RewriteRule ^ajax /wp-admin/admin-ajax.php [QSA,L]
RewriteRule ^wp-content/themes/richer-child/screenshot\.png|readme \.html|license\.txt|wp-content/debug\.log|wp-includes/$ /nothing_404_404 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Any idea what to change to fix this issue? The site is being hosted on Google Cloud Compute Engine. Thanks in advance for the help
Here's my VHost config (at least the part that's relevant to this topic)
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName akcrossfit.com:443
        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
Comment: What do you see in your access log?
Answer: When I try to go to the site over https it redirects me to the non-https URL but I suspect the problem is with the WordPress address and site URL in Settings >> General.
When you view the site, the references to your CSS and Javascript files are going to be linked over http which will prevent some browsers from loading the insecure content.
If you want the site to be secure, change your WordPress address to the https URL so the resources and links use SSL.
EDIT:  After being able to see the site over https, it looks like all of your resources (js, images, javascript) are coming back as 404 errors.  It even looks like the .htaccess rewrite rules aren't working for posts and pages.  This is most likely due to an error with the VHost configuration for the SSL site.  Apache error logs may help but I'd look at the SSL vhost first to see how it differs from the main site.
EDIT 2:  The problem is now that in your <Directory /var/www/> section there is AllowOverride None which effectively disables the .htaccess rewrite rules from being applied.
Comment: Sorry about that... I had a plugin that was redirecting. There's only a couple pages on the site that needs to be secure so I'm not interested in securing the whole site.

I've done this before but not on Google Cloud.
Comment: @DarrenJackson i updated the answer, it looks like all of the site resources are coming back with 404 errors on the ssl host.
Comment: Thanks for your help. I'm going to look into this today and get back to you.
Comment: I now have the front page of the site looking the way it's supposed to (https://akcrossfit.com) since the theme no longer needs htaccess to point to the css file.

I'm sure the SSL is working or I'd get a 404 error on the front page.

But for some weird reason, https doesn't see the htaccess file because when you try and navigate, you get 404 errors on all interior pages.
Comment: Looks like the resources are loading properly now but the .htaccess file isn't being processed for the ssl vhost.  Is `AllowOverride None` set on the vhost or does it have the necessary `AllowOverride All` specified?  If it is none or not set, then Rewrite rules and other directives will be ignored by apache.
Comment: Just edited the original post to include the VHost config. Can you see the issue? I changed AllowOverride None to All and restarted apache but it didn't help.
Comment: @DarrenJackson Just saw that you got it working, I noted that the AllowOverride None in the /var/www/ Directory section probably was preventing the rewrite rules from being applied.


Newtonsoft pegar parte do JSON

Question: Estou trabalhando com C# e quero pegar parte do JSON retornado pela requisição PostAsync  e este é o retorno da REQUEST:

{"meta":{"status":422,"error":true},"error":{"status":1102,"msg":"Invalid email, enter email in the format email@example.com"}}

Criei a seguinte classe para verificar se error está com true ou false, mas não consegui pegar parte do JSON e associar à classe.
public class Meta
{
    [JsonProperty("meta.status")]
    public string Status { get; set; }

    [JsonProperty("meta.error")]
    public bool Error { get; set; }
}

Answer: Esse tipo de informação que está no formato JSON para extrair a informação com o pacote que está anexado a sua pergunta precisa ter um conjunto de classes, seguindo o exemplo abaixo:
public class Rootobject
{
    public Meta meta { get; set; }
    public Error error { get; set; }
}

public class Meta
{
    public int status { get; set; }
    public bool error { get; set; }
}

public class Error
{
    public int status { get; set; }
    public string msg { get; set; }
}

Código
var json = "{ ... }";
var result = Newtonsoft
            .Json
            .JsonConvert
            .DeserializeObject<Rootobject>(json);

result.meta.status // status
result.meta.error // error

Você também pode decorar o objeto igual você fez, mas, é cada item na configuração deve ser respeitado.
Comment: Grato @Virgilio Novic, testei e funcionou

Newtonsoft pegar parte do JSON


How to get the value of last assigned property in Sass or CSS?

Question: I know of the inherit and initial properties, but I don't want them. I want to give the same value of the last CSS rule. Basically, a placeholder or dummy.
The reason I want to do this is because I'm using the Compass mixin link-colors:
@mixin link-colors($normal, $hover: false, $active: false, $visited: false, $focus: false) {
  color: $normal;
  @if $visited {
    &:visited {
      color: $visited;
    }
  }
  @if $focus {
    &:focus {
      color: $focus;
    }
  }
  @if $hover {
    &:hover {
      color: $hover;
    }
  }
  @if $active {
    &:active {
      color: $active;
    }
  }
}

I don't want to set anything to the first argument, which is $normal. I know I can set the values to their respective names like so:
@include link-colors($hover: $nav-link-hover-color, $active: $nav-link-hover-color);

However, this will give me an error, as I didn't assign anything to $normal.
As you can see, $normal is not optional; however, I only want to set colors to the others, not normal. It has already been set a color before, and I do not wish to override it.
Also, is there a way to set a value for all the arguments? Say link-colors(white) and it carries on to be set to all the arguments?
Comment: Then copy that mixin into your own mixin-file to overwrite and edit it…
Answer: If all you want is to have all arguments be the same value, what you're looking for is a function that's commonly called fill or array-fill in other languages.  As long as you know exactly how many arguments the mixin takes, you're good to go:
@function array-fill($value, $n) {
    $list: ();
    @for $i from 1 through $n {
        $list: append($list, $value);
    }
    @return $list;
}

a {
  @include link-colors(array-fill(white, 5)...);
}

Output:
a {
  color: white;
}
a:visited {
  color: white;
}
a:focus {
  color: white;
}
a:hover {
  color: white;
}
a:active {
  color: white;
}

If you want to be able to specify specific values and not use the $normal argument, then you can do that by passing null as the value for that argument:
@include link-colors(null, $hover: $nav-link-hover-color, $active: $nav-link-hover-color);

Output:
a:hover {
  color: white;
}
a:active {
  color: white;
}

You can also combine these solutions:
a {
  @include link-colors(null, array-fill(white, 4)...);
}

Output:
a:visited {
  color: white;
}
a:focus {
  color: white;
}
a:hover {
  color: white;
}
a:active {
  color: white;
}

Comment: Perfect, thank you. Exactly what I wanted. I had just found out about the ability to use `null` when you answered.


What does the Microsoft.WebApplication.targets import do in VS 2010 web application projects?

Question: Visual Studio 2010 seems to insist on having this import in web application projects
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

What does this import give us and is it really required?
On a side note if you remove this import with a text editor Visual studio will re-add it.
The reason i am asking is when the project is compiled on a build server that target does nor exists because visual studio is not installed.
Answer: As suggested in the comments to Raj Kaimal's answer, to get this working you can copy over the folder to the same location on the build machine.
If you want, you can also put that folder somewhere else in your machine, even relative to your project.  You just need to add something to the csproj to redirect MSBuildExtensionsPath..
For example, I have the following in my csproj (works for VS2010 and VS2012):
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<PropertyGroup>
    <MSBuildExtensionsPath32>..\lib\MSBuild.MSVS\</MSBuildExtensionsPath32>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"/>

Then, within my lib folder (which is a sibling of the folder containing the csproj), I have copied the following directories:

%ProgramFiles%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications →
MSBuild.MSVS\Microsoft\VisualStudio\v10.0\WebApplications
%ProgramFiles%\MSBuild\Microsoft\VisualStudio\v10.0\Web → MSBuild.MSVS\Microsoft\VisualStudio\v10.0\Web
Answer: Contains entries for MSBuild
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications
Use the publish option in VS 2010 to create a zip package that you can deploy on your server (MS Deploy)
read this: http://vishaljoshi.blogspot.com/2009/03/how-does-web-deployment-with-vs-10.html
What build server are you using?
Comment: Copy the contents of the path above and put it in the same path on your bulid server. Ensure .NET 4 is installed on the build server. Try building.
Comment: not so easy when a 3rd party owns the build server http://teamcity.codebetter.com/overview.html . But i will ask them
Comment: turns out it is a little more complicated than that
http://richardsbraindump.blogspot.com/2009/11/how-to-build-vs2010-solutions-using.html
Answer: We have a situation where our CI build server also hosts some web sites.  It doesn't have a version of Visual Studio installed, so the link to the MSBuildExtensions broke our build on the upgrade to vs2010/.net4.0.
It seems like overkill to have to install VS2010 on the build machine if it's not a dev machine as well... could I just install the MSBuild Extension Pack (http://msbuildextensionpack.codeplex.com/) on the build server and have it work out alright?  I currently can't verify that this works, but from what I was able to accomplish prior to this post, it seems like a better option than installing VS2010.
-Daniel
Comment: good point daniel. although your post should be a comment not an answer
Comment: I tried this and unfortunately I don't think the MSBuild Extension Pack includes the WebApplications target, the one mentioned in this question.
Answer: If you don't deploy from the build server, then you can turn off the Microsoft.WebApplication.targets on the build server. See my answer here: https://stackoverflow.com/a/35781566/4955344
Comment: Maybe the original question should be marked as a duplicate of this link?


How can I assign the output of a function *with parameters* to a variable using bash?

Question: Similar to How can I assign the output of a function to a variable using bash?, but slightly different.
If I have a function like this:
function scan {
  echo "output"
}

...I can easily assign this to a variable like this:
VAR=$(scan)

Now, what if my function takes one or more parameters, how can I pass them to the function using the "shell expansion" syntax? E.g. this:
function greet {
  echo "Hello, $1"
}

# Does not work
VAR=$(greet("John Doe"))

The above produces an error like this with my bash (version 5.0.3(1)-release):
$ ./foo.sh
./foo.sh: command substitution: line 8: syntax error near unexpected token `"John Doe"'
./foo.sh: command substitution: line 8: `greet("John Doe"))'

Answer: in this code :
function greet {
  echo "Hello, $1"
}

# Does not work
VAR=$(greet("John Doe"))

the error is the parenthesis passing parameters.
try to do this:
function greet {
  echo "Hello, $1"
}

# works
VAR=$(greet "John Doe")

it should work.
Explanation: when you use the $ an the parenthesis you have to write inside the parenthesis command as in a shell so the parameters are passed without parenthesis.
Comment: Oh sorry, i don't see your answer from my mobile. Regards
Comment: Thanks. I already documented this (at the same time as writing the question) here: https://stackoverflow.com/a/59388263/227779 :-)
Comment: Why would I upvote it when it mostly just duplicates my answer which was written before? I discovered the answer to my question while writing it, but decided to write down the answer Q&A-style. Thanks for writing a reply, but your answer doesn't add much more than what my answer already stated.
Comment: Fair enough. I will upvote your answer now in good will. :) Merry Christmas!
Answer: I have obviously been writing to much Java code lately. Drop the parentheses when calling the function and everything works flawlessly:
function greet {
  echo "Hello, $1"
}

VAR=$(greet "John Doe")


Retaining context from in reactive streams

Question: Can someone help me understand how context is passed on in reactive streams.
See below code for example:
Flux<Integer> expectedFluxWithContext = Flux.just(1, 2, 3, 4)
        .flatMap(item -> Mono.just(item).contextWrite(Context.of("traceId", item)))
        .doOnEach(signal -> System.out.println(signal.getContextView()));

When I run the above code I am getting the correct data as I would expect but in doOnEach operator the context is empty.
Can anyone help me to understand how context is shared in streams and what changes I can make to make this work.
Answer: context is only available "upwards" in the pipeline as it is attached at subscribe time, and that does not know about anything downstream. It is not meant to pass things that are acquired during the pipeline execution, if you want to "pass" that, you might want to use Tuples.
For more info I suggest reading the appropriate parts of the Reactor reference guide:
https://projectreactor.io/docs/core/release/reference/#context
Comment: `context is only available "upwards" in the pipeline as it is attached at subscribe time`
That cleared it up for me, I was confused because the concept was introduced to me as a map-like datastructure similar to threadlocals, and I was trying to use it for resource-cleanup.

But the context is created/populated at subscription time and available as a readonly-view during execution.


Intersection of a sphere with center at (0,0,0) and a plane passing through the this center (0,0,0)

Question: I have been asked to show that the intersection of a sphere and a plane is a circle using two methods, at least this is my interpretation of a problem in a text.
The first method was something to do with hamilton's principle. It resulted in an integral from the pit of hell. I might ask a separate question about these integrals later.
What I am having trouble with at the moment is the more vanilla way of doing this.
I wrote down what I believe to be the equation of a plane.
$ax + by + cz + d = 0$
so in scalar form something familiar like:
$a(x - x_0) + b(y - y_0) + c(z-z_0) = 0$
I just then said the equation of the plane through (0,0,0) is
$x + y + z = 0$
I wrote the equation for a sphere similarly with the center at (0,0,0) to be
$x^2 + y^2 + z^2 = r^2$
I tried to solve for $z$ of the plane, and substitute it into the sphere equation in hopes of getting the equation of a circle.
Something that looks like
$(x-h)^2 + (y - k)^2 = r^2$
This did not happen.
I got
$2x^2 + 2xy + 2y^2 = r^2$
setting r to 1
$2(x^2 + xy +y^2) = 1$
It would seem I can rewrite this as
$(x + y)^2 + x^2 + y^2  = 1$
I don't think I have made any illegal moves. What's going on?
Comment: Are you allowed to choose the plane arbitrarily, or why did you choose your plane equation as $x+y+z=0$? What calculations did you do to obtain your "ellipse equation"?
Comment: The idea is to find a circle whose center lies at the center of a sphere.  I wanted to pick a plane that passes through the center.  We want the plane to contain the point  (0,0,0) I think. I think this is the only requirement.  For  I set a = b = c = 1 to make things simple. I did straightforward algebra to try to get the equation of a circle
Comment: Also, I have now removed  " I seem to get an ellipse" from the post. However, If you set r = 1 you get an ellipse I think
Answer: For any plane through the origin, you can rotate the sphere so that the plane has the equation $z=0$. Since rotation of the sphere leaves the sphere fixed, its equation is still $x^2+y^2+z^2=r^2$
Setting $z=0$, gives $x^2+y^2=r^2$ which is a circle.
Answer: $ax+by+cz=0$ is the equation of a plane through the origin. The normal to that plane is $(a,b,c)$.
You've chosen a particular plane $x+y+z=0$ which is a plane through the origin with the normal pointing along the line defined by $x=y=z$. Then clearly $z=-x-y$ and you get $$x^2+y^2+(x+y)^2=r^2\tag{1}$$ as the equation of the circle, but the circle is in a plane at an angle of $45^\circ$ to any of the existing axes. To get that into the form $p^2+q^2=r^2$ you need to rotate $x'=x\cos45+y\sin45$, $y'=y\cos45-x\sin45$, then $z'=z\cos45+x'\sin45$, $x''=x'\cos45-z\sin45$, and then (1) will turn into an equation like $x''^2+y'^2=r^2$.
While that might be a useful exercise to do, you might have been better off picking a plane like $z=0$.


Integer solutions to $a^{2014} +2015\cdot b! = 2014^{2015}$

Question:
How many  solutions are there for $a^{2014} +2015\cdot b! = 2014^{2015}$, with $a,b$ positive integers?

This is another contest problem that I got from my friend.
Can anybody  help me  find the answer? Or  give me a hint to solve this problem?
Thanks
Comment: Could you provide more detail about what contest it is from?
Answer: Taking this equation mod $2015$ yields $a^{2014} \equiv -1 \pmod{2015}$.
Since $2015 = 5 \cdot 13 \cdot 31$, we get the following:
$a^{2014} \equiv -1 \pmod{5}$
$a^{2014} \equiv -1 \pmod{13}$
$a^{2014} \equiv -1 \pmod{31}$
By Fermat's Little Theorem, $a^{31} \equiv a \pmod{31}$. Hence, $a^4 \equiv a^{2014} \equiv -1 \pmod{31}$.
We can check that $-1$ is not a quadratic residue $\pmod{31}$. Thus, there is no residue $a^2$ such that $(a^2)^2 = a^4 \equiv -1 \pmod{31}$. Therefore, there are no solutions to the original equation.
Comment: What is the useful for us to check that -1 isn't a quadratic residue mod 31?
Comment: Are you asking why it is useful to check that -1 isn't a quadratic residue mod 31, or are you asking how we can check that -1 isn't a quadratic residue mod 31?
Comment: Yes, I'm asking about how important for us to check that -1 isn't a quadratic residue mod 31. I don't know why you attack this problem with this way. Thanks
Comment: I have shown that if $(a,b)$ is a solution to the original equation, then $a^4 \equiv -1 \pmod{31}$. By checking that $-1$ is not a quadratic residue $\pmod{31}$, we see that no integer $a$ satisfies $a^4 \equiv -1 \pmod{31}$. Therefore, there cannot be any solutions $(a,b)$ to the original equation.
Comment: Oh, I just knew that you shown that this problem didn't have any integer solution. So, your way is only to prove that there are no solutions for this problem? Thanks
Comment: @akusaja It's an immediate consequence of the fact that $\,-1\,$ is not a square mod $\,31\,$ because $\,31\not\equiv 1\pmod 4.\,$ See my answer for a generalization that clarifies the essence of the matter.
Comment: You could even just cut out the middle man and take the first equation mod 31.
Answer: Here's a line of attack that leaves you the task of checking only finitely many cases.
The idea is to check divisibility by powers of two. I use the notation $\nu(m)$ to denote
the exponent of the highest power of two that divides a positive integer $m$, so e.g. $\nu(80)=\nu(16\cdot5)=4$, because $2^4=16$.
You have probably seen (or can prove it as an exercise) that
$$
\nu(m!)=\sum_{i=1}^{\lceil \log_2m\rceil} \lfloor\frac m {2^i}\rfloor.\qquad(*)
$$
Also $\nu(mn)=\nu(m)+\nu(n)$, and consequently $\nu(m^n)=n\nu(m)$. Furthermore, if $\nu(a)\neq\nu(b)$ then $\nu(a+b)=\min\{\nu(a),\nu(b)\}$. This latter property is known as non-Archimedean triangle inequality. Let's call it NATI for short.
Here we see that $\nu(2014^{2015})=2015\cdot\nu(2014)=2015$ because $2014$ is even, but not divisibile by four.
Let us first consider the possibility that $a$ is odd. Then so is $a^{2014}$, so $2015\cdot b!$ must be odd. This is possible only, if $b!$ is odd, so we must have $b=0$
or $b=1$ for otherwise $b!$ is even. Check, whether there is matching $a$.
Let us then turn our attention to the possibility that $a$ is even. We first assume that $a$ is not divisible by four or, equivalently, that $\nu(a)=1$. In that case $\nu(a^{2014})=2014$. Because $\nu(2014^{2015})=2015$, NATI restricts the choice of $b$ to those numbers that have $2014=\nu(2015\cdot b!)=\nu(b!)$. Formula $(*)$ comes in handy. I give you the extra bit $\nu(2022!)=2014$. There are very few other possibilities for $b$, because $\nu(b!)$ is a (non-strictly) increasing function of $b$.
Finally, if $\nu(a)>1$, then $\nu(a^{2014})\ge2\cdot2014$, which is greater than $2015$. In this cases NATI forces $\nu(b!)=2015$. This again severely limits the possibilities for $b$.
Comment: Altogether this leaves four possibilities for $b$: $0,1,2022,2023$. Armed with a CAS it is easy to check that none of these work. G.T.R can eliminate the big ones. JimmyK (+1) does everything very differently.
Comment: is it possible for us to find the solution only by hand? it seems that the number is very big for us. Thanks
Answer: Not the whole solution, but enough to get going.
We have that $\displaystyle a^{2014}+b!\equiv 0 \pmod{2014}$

If $b\geq 53$, then $\displaystyle a^{2014}\equiv 0 \pmod{2014}$.

Since $2014=2\times19\times53$, this implies $\displaystyle a\equiv 0 \pmod{2014}$
Hence $a=2014k$ for some positive $k$
Plugging this in yields $\displaystyle 2014^{2014}k^{2014}+2015  b!=2014^{2015}$
Hence $2014^{2014}(2014-k^{2014})=2015  b!$
The RHS being positive, so is the LHS, and thefore $2014\geq k^{2014}$, which forces $k=1$
Therefore $a=2014$. Furthermore, $2014^{2014}(2013)=2015  b!$ is clearly a contradiction.

Thus, $b\leq 52$
Comment: @akusaja yes, there is no solution.
Comment: @JyrkiLahtonen major failure in my reasoning. It's fixed now but less interesting. Does your answer give a better bound on $b$ ?
Comment: My line leaves four possible values for $b$. Two of which are $b=0$ and $b=1$. The OP asked for hints only, so I didn't check any of those. The other two are $>53$, so your argument helps :-)
Comment: @G.T.R, must we check all possibilities for b<= 52, or we can simply say that the number of solutions for this problem is 53? thanks
Comment: @akusaja See what Jyrki has written in his comment "Altogether this leaves four possibilities for $b: 0,1,2022,2023$. Armed with a CAS it is easy to check that none of these work. G.T.R can eliminate the big ones. JimmyK (+1) does everything very differently. "
Comment: @G.T.R, so there is no integer solutions for this problem? I think that is the conclusion by Jyrki? Thanks
Answer: Hint $ $  If $\,n\,$ is odd,  and $\ a^{n-1}\! + n b = (n-1)^{2j+1} $  then every prime $\,p\,$ dividing $\,n\,$ is $\,\equiv 1\pmod 4 $
since $\ n\!-\!1 = 2k,\,$ so $\, {\rm mod}\ p\!:\ (a^k)^2 \equiv\, -1,\ $ so by Euler or reciprocity, $ $ we infer $\ p\equiv 1\pmod 4$
Comment: @akusaja $ $ Above, since $\,n=2015\,$ is odd, $\  n -1\,$ is even, $ $ therefore $\,n-1 = 2k.\,$ Now reduce $\,a^{n-1}\!+\color{#c00}nb\, =\, (\color{#0a0}{n\!-\!1})^{2j+1}\,$ mod $\,p,\,$ where $\,p\mid n\,\Rightarrow\,\color{#c00}{n\equiv 0}\,\Rightarrow\,\color{#0a0}{n\!-\!1\equiv -1}.\, $ Therefore, mod $\,p\,$ we get $\ a^{2k}\, +\,\ \color{#c00}0\  \ \equiv\ \ (\color{#0a0}{-1})^{2j+1}\equiv\, -1,\ $ thus $\ {-}1\,\equiv\, (a^k)^2\,$ is a square mod $\,p,\,$ hence $\,p\equiv 1\pmod{4}\quad $
Comment: By seeing Jimmy's solution, is your hint convinced us to conclude that there is no solution for this problem? Thanks
Comment: @akusaja $ $ Does $\ n = 2015 = 5\cdot 13\cdot 31\ $ have every prime divisor $\equiv 1\pmod 4\,?\ \ $
Comment: no, 2015 didn't have any prime divisor, such that ≡ 1(mod 4) because it's didn't fit with Euler's theorem. From here, can we say that because every prime divisor of 2015 isn't ≡ 1(mod 4), so this problem has no solution? Thanks
Comment: @akusaja $2015$ does not have *every* prime divisor $\,\equiv 1\pmod 4\,$ since $\,31\equiv 3.\,$ You will encounter similar criteria for other Diophantine equations, so it is instructive to bring this innate structure to the foreground, to help you more easily recognize analogous instances in the future.
Comment: The only thing that I still don't understand is: why Taking this equation mod 2015 yields a^2014 ≡−1(mod2015) ? Thanks


Finding moments $M_x$ and $M_y$ and center mass of a region

Question:
Set up integrals for the moments, $M_x$ and $M_y$, and the center of mass of the region (constant density, do not evaluate integrals)

The region is a tall rectangle with a semi-circle on top. $r=3,\;h=11$
From what I've learned, moments $M_x$ and $M_y$ can be found by:
$$\int_a^b \frac12[f(x)]^2 dx \;\;\;\text{ and } \;\;\int_a^b xf(x) dx \;\;\;\;\;\text{respectively}$$
I realize that I can use $x^2+y^2=1 \rightarrow \sin^2t + \cos^2t = 1$ for the semi-circle, but what do I do for the rectangle? (if that's even the correct method...)
The center can be found be dividing each moment by the area, which in this case the area of the semi-circle is $\frac{9\pi}{2}$(center at $(0,\frac\pi4))$ and rectangle is $66$
Comment: The rectangle is nothing more than a bunch of lines, so if you may find the moment and center of mass of a line, you can extend that to find the center of mass and thus the moment of a rectangle...
Comment: how could I display this as an integral?
Answer: Moments typically take the form
\begin{equation}
I_x=\sum\limits_{i=1}^{n}\left(I_x^{\left(i\right)}\right), \:\text{and}\:I_y=\sum\limits_{i=1}^{n}\left(I_y^{\left(i\right)}\right),
\end{equation}
keeping in mind the equation $I=Mr^2$ for a point mass. So what the sums above are doing is basically adding up all of the bits of mass along the radius squared (in this case discretely, so if we had a bunch of points containing the mass the above would sorta be fine). For a continuous distribution of mass we must use integrals and rewrite the above as
\begin{equation}
I_x=\int\limits_{0}^{M}r^2\:dM,\:\text{and}\:I_y=\int\limits_0^{M}r^2\:dM.
\end{equation}
Notice that these integrals are with respect to $dM$ instead of the length, however. The above equation could be rewritten as
$$ dI=r^2\:dM$$
for a point mass then, and what we want to do is add up all of the $dI$'s along $r$, so we must rewrite the $dM$, or the mass of each individual point, in terms of the geometry of the object. So for a "rod" (line) it will simply be the mass distribution along the length, and if the density is uniform and does not depend on the point within the rod then our $dM$ may be rewritten as
$$dM=\frac{M}{L}\:dr,$$
because the mass-distribution for a uniform "line" is simply the mass of the rod divided by the length of the rod. If density were to be taken into consideration, then we would rewrite our $dM$ as $$dM=\rho\left(r\right)dV=\rho\left(r\right)\:dr$$
for a rod. This allows us to find that, for a rod, the sum of all of the $dI$'s is thus
$$I=\int\limits_{\frac{-L}{2}}^{\frac{L}{2}}\frac{M}{L}r^2\:dr=\frac{L^2M}{12}.$$ Notice also I've changed the limits of integration so that we have the rotational axis positioned at the center.
Now to answer your question. Since we will be finding the moment of a rectangular plate we could apply what we know about the rod, or we could add up all of the $dI$'s in both directions using a double-integration to sum them up in one direction first, and then sum them in the orthogonal direction.
The first method might be slightly easier (though I would prefer the second). Using the parallel-axis theorem we could just sum up all of the rods we've already calculated at different distances from the axis of rotation:
$$dI=\frac{dM\:L^2}{12}+dM\:x^2.$$
As stated above, we must again rewrite our $dM$ in terms of the geometry of the object. Now we're dealing with an area instead of just a length, so we have
$$dM=\rho\left(r\right)\:dV$$
and our "volume" could be thought of as the area of a tiny rectangular region, $dV=dX\cdot dY$. Since the density distribution is assumed to be uniformly $1,$ we don't have to necessarily worry about $dX$ and $dY$ (I'll come back to this in a bit), so we have $dM=\frac{M}{L^2}\cdot L\cdot dx$, or the mass of the entire plate divided by the area of the plate (our mass-distribution) times the area of that piece of mass (which for the rod was just $dr$), and we can replace this to get
$$dI=\frac{ML\:dx}{12}+\frac{Mx^2}{L}\implies I=\int\limits_{\frac{-L}{2}}^{\frac{L}{2}}\left(\frac{ML\:dx}{12}+\frac{Mx^2}{L}\right)=\frac{ML^2}{6}.$$
Notice this is twice the result of just one rod. If we were to use a double integral, considering our $dV=dX\cdot dY$ we would arrive at the same conclusion if the density is uniform:
\begin{equation}
\int_{\frac{-L}{2}}^{\frac{L}{2}}\int_{\frac{-L}{2}}^{\frac{L}{2}}\left(X^2+Y^2\right)\rho\left(x,\:y\right)\:dX\:dY\bigg|_{\rho\left(x,\:y\right)=1}=2\cdot \int\limits_{\frac{-L}{2}}^{\frac{L}{2}}\frac{M}{L}r^2\:dr=\frac{ML^2}{6},
\end{equation}
and if we were to try and find the $I$ of a cube we would write
\begin{equation}
\int_{\frac{-L}{2}}^{\frac{L}{2}}\int_{\frac{-L}{2}}^{\frac{L}{2}}\int_{\frac{-L}{2}}^{\frac{L}{2}}\left(X^2+Y^2+Z^2\right)\rho\left(x,\:y,\:z\right)\:dX\:dY\:dZ\bigg|_{\rho\left(x,\:y,\:z\right)=1}=3\cdot \int\limits_{\frac{-L}{2}}^{\frac{L}{2}}\frac{M}{L}r^2\:dr=\frac{ML^2}{4}.
\end{equation}
So you may change the limits and manipulate the equations above to fit your needs for a rectangular plate or a rectangular prism of any dimensions. Just note that things get a lot more complicated as more dimensions and different situations are considered (such as rotating about an axis at various angles instead of perpendicular to the sides). It's neat to think about, however, such as what the moment might look like for a tumbling asteroid or something of the sort, which would thus change periodically as the object rotated and we must consider that it's not a perfect shape,such as a box but has many, many sides.
Comment: thank you, this helps.  Also, to confirm my answer, did you happen to get $(0,6.77)$ for the center of mass?


My batch program exits and i dont know why

Question: So, I made a war strategy game. The idea is that you should attack the other country with 3 weapons: Airstrike, Nuke and Missile. When I choose a weapon, sometimes the batch file exits without showing a error. I want to fix this, but I don't know how. The batch program uses external command batbox.exe. Download it from http://www.mediafire.com/download/rwxl04379rtchaq/batbox.exe
<code>@echo off
mode con: cols=80 lines=26
cls
title WW3
set nukeprice=80
set airstrikeprice=40
set missileprice=20
set healthprice=95
:menu
cls
echo                             World War 3
echo.
echo [Start Game]
echo [About]
echo [Exit]
for /f "delims=: tokens=1,2" %%A in ('batbox /m') do (
set x=%%A
set y=%%B
)
if %y%==2 (
if %x% geq 1 if %x% leq 12  (
goto setcountry
)
)
if %y%==3 (
if %x% geq 1 if %x% leq 7  (
goto about
)
)
if %y%==4 (
if %x% geq 1 if %x% leq 7  (
exit
)
)
goto menu
:setcountry
cls
echo Select your country.
echo.
echo [USA]
echo [Russia]
echo [Canada]
echo [UK]
for /f "delims=: tokens=1,2" %%A in ('batbox /m') do (
set x=%%A
set y=%%B
)
if %y%==2 (
if %x% geq 1 if %x% leq 5  (
set country=USA
goto setcpucountry
)
)
if %y%==3 (
if %x% geq 1 if %x% leq 8  (
set country=Russia
goto setcpucountry
)
)
if %y%==4 (
if %x% geq 1 if %x% leq 9  (
set country=Canada
goto setcpucountry
)
)
if %y%==5 (
if %x% geq 1 if %x% leq 4  (
set country=UK
goto setcpucountry
)
)
goto setcountry
:setcpucountry
set /a cpucountryran=%random% %%4 + 1
if %cpucountryran%==1 set enemy=USA
if %cpucountryran%==2 set enemy=Russia
if %cpucountryran%==3 set enemy=Canada
if %cpucountryran%==4 set enemy=UK
if %enemy%==%country% goto setcpucountry
goto setammo
:setammo
set missiles=3
set airstrike=2
set nuke=1
set health=1000
set money=100
set cpumissiles=3
set cpuairstrike=2
set cpunuke=1
set cpumoney=100
set cpuhealth=1000
:play
cls
echo %country%
echo HP: %health%
echo %money%$
echo.
echo [Nuke x %nuke%]
echo [Airstrike x %airstrike%]
echo [Missiles x %missiles%]
echo.
echo [Shop]
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo                                                                        %enemy%
echo                                                                        HP: %cpuhealth%
echo                                                                            %cpumoney%$
echo                                                                      [Nuke x %cpunuke%]
echo                                                                 [Airstrike x %cpuairstrike%]
echo                                                                  [Missiles x %cpumissiles%]
for /f "delims=: tokens=1,2" %%A in ('batbox /m') do (
set x=%%A
set y=%%B
)
if %y%==4 (
if %x% geq 1 if %x% leq 9  (
goto nuke
)
)
if %y%==5 (
if %x% geq 1 if %x% leq 14  (
goto airstrike
)
)
if %y%==6 (
if %x% geq 1 if %x% leq 13  (
goto missiles
)
)
if %y%==8 (
if %x% geq 1 if %x% leq 6  (
goto shop
)
)
goto play
:nuke
if "%nuke%" leq "0" (
echo You are out of Nukes!
ping localhost -n 2 >nul
set nuke=0
goto play
)
cls
echo %country% shot a Nuke on %enemy%!
echo.
set /a nukehit=%random% %%2 + 1
if %nukehit%==1 (
echo Miss!
)
if %nukehit%==2 (
echo Hit!
echo.
echo %enemy% lost 40 HP!
echo.
echo You got 25$!
set /a cpuhealth=%cpuhealth%-40
set /a money=%money%+25
set /a nuke=%nuke%-1
)
if "%cpuhealth%" leq "0" goto win
ping localhost -n 3 >nul
goto cpuplay
:airstrike
if %airstrike% leq 0 (
echo You are out of Airstrikes!
set airstrike=0
ping localhost -n 2 >nul
goto play
)
cls
echo %country% shot a Airstrike on %enemy%!
echo.
set /a airstrikehit=%random% %%2 + 1
if %airstrikehit%==1 (
echo Miss!
)
if %airstrikehit%==2 (
echo Hit!
echo.
echo %enemy% lost 20 HP!
echo.
echo You got 15$!
set /a cpuhealth=%cpuhealth%-20
set /a money=%money%+15
set /a airstrike=%airstrike%-1
)
if %cpuhealth% leq 0 goto win
ping localhost -n 3 >nul
goto cpuplay
:missiles
if %missiles% leq 0 (
echo You are out of Missiles!
set missiles=0
ping localhost -n 2 >nul
goto play
)
cls
echo %country% shot a Missile on %enemy%!
echo.
set /a missilehit=%random% %%2 + 1
if %missilehit%==1 echo Miss!
if %missilehit%==2 (
echo Hit!
echo.
echo %enemy% lost 10 HP!
echo.
echo %country% got 5$!
set /a cpuhealth=%cpuhealth%-10
set /a missiles=%missiles%-1
set /a money=%money%+5
ping localhost -n 3 >nul
)
if %cpuhealth% leq 0 goto win
ping localhost -n 3 >nul
:cpuplay
set /a cpuweapon=%random% %%4 + 1
if %cpuweapon% equ 1 goto cpunuke
if %cpuweapon% equ 2 goto cpuairstrike
if %cpuweapon% equ 3 goto cpumissile
if %cpuweapon% equ 4 goto cpushop
goto cpuplay
:cpunuke
if "%cpunuke%" leq "0" goto cpuplay
cls
echo %enemy% shot a Nuke on %country%!
echo.
set /a cpunukehit=%random% %%2 + 1
if %cpunukehit%==1 (
echo Miss!
ping localhost -n 3 >nul
)
if %cpunukehit%==2 (
echo Hit!
echo.
echo %country% lost 40 HP!
echo.
echo %enemy% got 25$!
set /a health=%health%-40
set /a cpumoney=%cpumoney%+25
set /a cpunuke=%cpunuke%-1
ping localhost -n 3 >nul
)
if "%health%" leq "0" goto lose
goto play
:cpuairstrike
if "%cpuairstrike%" leq "0" goto cpuplay
cls
echo %enemy% shot a Airstrike on %country%!
echo.
set /a cpuairstrikehit=%random% %%2 + 1
if %cpuairstrikehit%==1 (
echo Miss!
ping localhost -n 3 >nul
)
if %cpuairstrikehit%==2 (
echo Hit!
echo.
echo %country% lost 20 HP!
echo.
echo %enemy% got 15$!
set /a health=%health%-20
set /a cpumoney=%cpumoney%+15
set /a cpuairstrike=%cpuairstrike%-1
ping localhost -n 3 >nul
)
if "%health%" leq "0" goto lose
goto play
:cpumissile
if "%cpumissile%" leq "0" goto cpuplay
cls
echo %enemy% shot a Missile on %country%!
echo.
set /a cpumissilehit=%random% %%2 + 1
if %cpumissilehit%==1 (
echo Miss!
ping localhost -n 3 >nul
)
if %cpumissilehit%==2 (
echo Hit!
echo.
echo %country% lost 10 HP!
echo.
echo %enemy% got 5$
set /a health=%health%-10
set /a cpumoney=%cpumoney%+5
set /a cpumissile=%cpumissile%-1
ping localhost -n 3 >nul
)
if "%health%" leq "0" goto lose
goto play
:cpushop
set /a cpubuyran=%random% %%4 + 1
if %cpubuyran% equ 1 (
if %cpumoney% lss %missileprice% goto cpushop
if %cpumoney% geq %missileprice% goto cpubuymissile
)
if %cpubuyran% equ 2 (
if %cpumoney% lss %airstrikeprice% goto cpushop
if %cpumoney% geq %airstrikeprice% goto cpubuyairstrike
)
if %cpubuyran% equ 3 (
if %cpumoney% lss %nukeprice% goto cpushop
if %cpumoney% geq %airstrikeprice% goto cpubuynuke
)
if %cpubuyran% equ 4 (
if %cpumoney% lss %healthprice% goto cpushop
if %cpumoney% geq %healthprice% goto cpubuyhp
goto cpushop

:cpubuymissile
set /a cpumissiles=%cpumissiles%+1
set /a cpumoney=%cpumoney%-20
cls
echo %enemy% bought a Missile!
ping localhost -n 2 >nul
goto play

:cpubuyairstrike
set /a cpuairstrike=%cpuairstrike%+1
set /a cpumoney=%cpumoney%-40
cls
echo %enemy% bought a Airstrike!
ping localhost -n 2 >nul
goto play

:cpubuynuke
set /a cpunuke=%cpunuke%+1
set /a cpumoney=%cpumoney%-80
cls
echo %enemy% bought a Nuke!
ping localhost -n 2 >nul
goto play

:cpubuyhp
set /a cpuhealth=%cpuhealth%+20
set /a cpumoney=%cpumoney%-95
cls
echo %enemy% bought 20 HP!
ping localhost -n 2 >nul
goto play

:win
cls
echo You won World War 3!
ping localhost -n 3 >nul
goto menu
:lose
cls
echo You lost the war!
ping localhost -n 3 >nul
goto menu
:about
cls
echo                       World War 3
echo.
echo Version: 1.0
echo Made by: HackerGamerLV
pause >nul
goto menu
:shop
cls
echo                                   Shop
echo.
echo [Missile] - %missileprice%$
echo [Airstrike] - %airstrikeprice%$
echo [Nuke] - %nukeprice%$
echo [20 HP] - %healthprice%$
echo.
echo [Exit Shop]
for /f "delims=: tokens=1,2" %%A in ('batbox /m') do (
set x=%%A
set y=%%B
)
if %y%==2 (
if %x% geq 1 if %x% leq 9  (
if %money% lss %missileprice% goto shopend
if %money% geq %missileprice% goto shopmissile
)
)
if %y%==3 (
if %x% geq 1 if %x% leq 11  (
if %money% lss %airstrikeprice% goto shopend
if %money% geq %airstrikeprice% goto shopairstrike
)
)
if %y%==4 (
if %x% geq 1 if %x% leq 6  (
if %money% lss %nukeprice% goto shopend
if %money% geq %nukeprice% goto shopnuke
)
)
if %y%==5 (
if %x% geq 1 if %x% leq 9  (
if %money% lss %healthprice% goto shopend
if %money% geq %healthprice% goto shophp
)
)
if %y%==7 (
if %x% geq 1 if %x% leq 11  (
goto play
)
)
goto shop
:shopend
echo You don't have enough money!
ping localhost -n 2 >nul
goto shop

:shopmissile
set /a money=%money%-%missileprice%
set /a missiles=%missiles%+1
echo You bought a Missile!
ping localhost -n 2 >nul
goto cpuplay

:shopairstrike
set /a money=%money%-%airstrikeprice%
set /a airstrike=%airstrike%+1
echo You bought a Airstrike
ping localhost -n 2 >nul
goto cpuplay

:shopnuke
set /a money=%money%-%nukeprice%
set /a nuke=%nuke%+1
echo You bought a Nuke!
ping localhost -n 2 >nul
goto cpuplay

:shophp
set /a money=%money%-%healthprice%
set /a health=%health%+20
echo You bought 20 HP!
ping localhost -n 2 >nul
goto cpuplay
</code>
Comment: You should use `ECHO ON` at the suspicious functions, so you can see what parts are working and where it fails. Btw. batch doesn't forbid indentation.
Answer: It appears that there is no closing parenthesis for:
<code>if %cpubuyran% equ 4 (
</code>
Please indent code appropriately.


Where can I find a list of all parameters/variables used in Postfix master.cf?

Question: In postfix master.cf, there are entries like this (for dovecot):
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} -n -m ${extension}

As far as i understand it, variables like ${sender}, ${user}, ${nexthop}, ${extension} are provided by postfix, but I was not able to find documentation of a list of all possible parameters. I need to know if there are more variables than these... As I have problems setting up my system as intended. I am looking for a variable that represents the mapping for an email to a virtual mailbox-username...
If someone knows where I can find such a list, I would be very thankfull!
Thanks very much!
Answer: As you see, the command name is pipe. This is a postfix built-in way to deliver mails to an external program, in this case dovecot.
The accepted parameters as well as the available variables are documented in its man page.
Comment: Hello Holger, Thanks ver much!!! I was not aware of that pipe is the command. I thought this is solely related to master (and in the master man page I had not found anything). Thanks very much, your answer made verything clear and was what i was looking for. thanks!


Can I capture clear text request SOAP envelope on a java axis2 client for https?

Question: I have a federal government (i.e. extremely security conscience) SOAP service that I have to connect to for a project. The problem I have having is that I am getting the dreaded
  SEVERE: SOAP header missing
  org.apache.axis2.AxisFault: SOAP header missing
  at  org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:180)

Throwable stack trace
I'm generating the client stub with wsdl2code and just calling the
 GetResponseTypeDef resp = stub.getRequest(requestypdef, headerTypeDef);

headerTypeDef appears to be correctly populated with the header information the service requests.
I want to capture the raw, clear text SOAP xml request being sent out but the endpoint uses https and I have zero visibility into the service. So wireshark really isn't an option.
I'm using the following on linux:
     axis2 1.5.4
     rampart 1.5.1
     wss4j 1.5.10
I am pretty certain that I am sending out the SOAP header, but I need to prove it. This service uses just about every subproject of the WS-* including security, policy, encryption and digital signing so there only about 100 places that can cause this thing to fail.
Any help would be appreciated.
Answer: Setup a proxy service like Charles and have it redirect to your HTTPS endpoint. That way you can trap the call before it gets encrypted and print out the XML payload. On a side note, you may want to work on your accept rate.
Answer: Would it be possible to add the org.apache.axis.transport logger to see what xml is being sent across the wire?  For example, her is how I have it defined in my log4j config:
<category name="org.apache.axis.transport">
    <priority value="DEBUG"/>
    <appender-ref ref="CONSOLE"/>
</category>


If $A$ and $B$ commute, then prove that so also do $A^m$ and $B^n$ for all positive integers $m$ and $n$.

Question:
If $A$ and $B$ commute, then prove that so also do $A^m$ and $B^n$ for all positive integers $m$ and $n$.

My Proof
So we want to show that, for all positive integers $m$ and $n$, $A^mB^n = B^nA^m$.
Let $P(n,m) = A^mB^n$, and let $A$ and $B$ be $p \times p$ matrices.
$n,m = 1$: $P(1, 1) = AB = BA$ Since we assumed that $A$ and $B$ commute.
We first perform induction over $n$.
$n = k, m = 1$: $P(k, 1) = AB^k = B^kA$ This is the induction hypothesis.
$n = k + 1, m = 1$: $P(k + 1, 1) = (AB^k)(B)$ By the induction hypothesis.
$= A(B^kB)$ Since matrix multiplication is associative.
$= AB^{k + 1}$
Q.E.D.
We lastly perform induction over $m$.
$n = 1, m = k$: $P(1, k) = A^k B = BA^k$ This is the induction hypothesis.
$n = 1, m = k + 1$: $P(1, k + 1) = (A)(A^k B)$ By the induction hypothesis.
$= (AA^k)(B)$ Since matrix multiplication is associative.
$= A^{k + 1}B$
Q.E.D.
I would greatly appreciate it if people could please take the time to review my proof for correctness.

Since both of the answers posted so far have been down-voted, I'm going to assume that they're both incorrect and instead post my new proof.
My New Proof
Let $A$ and $B$ be $n \times n$ matrices.
For every positive integer $m$, $A^m$ and $B$ commute.
Let $P(m) = A^nB = BA^m$.
$m = 1$: $P(1) = AB = BA$ Since we assumed that $A$ and $B$ commute.
$P(m) = A^mB = BA^m$ This is the induction hypothesis.
$P(m + 1) = (A)(A^mB)$ Since $(A)(A^mB) = (AA^m)B = A^{m + 1}B$.
$= (A)(BA^m)$ By the induction hypothesis.
$= B(AA^m)$ Since we assumed that $A$ and $B$ are commutative.
$= BA^{m + 1}$ Q.E.D.
For every fixed $m$ and variable $n$, $B^nA^m = A^mB^n$.
$P(1) = BA^m = A^mB$
$P(n) = B^nA^m = A^mB^n$ This is the inductive hypothesis.
$P(n + 1) = (B)(B^nA^m)$ Since $(B)(B^nA^m) = (BB^n)A^m = B^{n + 1}A^m$, since matrix multiplication is associative.
$= (B)(A^mB^n)$ By the inductive hypothesis.
$= A^m(BB^n)$ Since we proved in the last inductive proof that $A^m$ and $B$ commute for all $m$.
$= A^mB^{n + 1}$ Q.E.D.
I would greatly appreciate feedback as to whether my new proof is correct.
Comment: That's correct (and exactly what I said). I don't know why I got a downvote here.
Comment: In your induction over $n$ you got $P(k+1,1)=AB^{k+1}$, but that was the definition of $P(k+1,1)$.
Comment: in the second induction you must assume that $n$ is arbitrary not =1 and use your first induction.
Comment: As @Nightgap mentioned, you don't prove what you need to in your induction over $n$, or in fact over $m.$ The other problem is that you've only shown the result when one of $n$ or $m$ is $1$. You would need to show that for general $n,$ $P(n,k)=B^{n}A^{k}\Rightarrow P(n,k+1)=B^{n}A^{k+1}$ in order to prove it for all cases.
Comment: @Nightgap thanks for taking the time to respond. I wasn't the one who down-voted any of the answers. I'd like to up-vote your answer, but It's too unclear for me to understand if it's correct. If someone else can corroborate the correctness of your answer, then I will up-vote it to cancel-out the down-vote.
Comment: Hey @Nightgap, when I made my comment, I saw that you had pointed out the problem with the first induction and wanted to agree with that point, but my second point hadn't been made yet. I see that you have a correction for this in your answer, so I upvoted it.
Comment: @RideTheWavelet thanks a lot. My comment doesn't refer to your comment but to the new (corrected) proof of The Pointer ;).
Answer: You have to modify your second induction. Show for fixed $m$ that $A^kB^m=B^mA^k$ by induction over $k$.
For $k=1$ this is your first induction (if you correct it).
For $k>1$ you get $A^kB^m=AA^{k-1}B^m=AB^mA^{k-1}$ by induction hypothesis. Now the case $k=1$ yields that this is equal to $B^mAA^{k-1}=B^mA^k$ which you wanted to show.
Answer: The result has little to do with matrices and it is no more difficult to prove the following more general result:

Proposition. Let $a$ and $b$ be elements of a semigroup $S$. If $a$ and $b$ commute, then the subsemigroup of $S$ generated by $a$ and $b$ is commutative.

In your case, it would prove for instance that the matrices $A^2B^3AB^2A$ and $BAB^2A^3$ commute.
Proof. The elements of the subsemigroup of $S$ generated by $a$ and $b$ can be represented by nonempty words on the alphabet $\{a, b\}$. We claim that if $u$ and $v$ are two nonempty words, then $uv = vu$ in $S$.
Let us prove this result by induction on $n = |u| + |v|$ (here $|w|$ denotes the length of a word $w$).
If $n = 2$, then $(u,v) \in \{(a,a), (a,b), (b,a), (b,b)$} and the result is obvious since $ab = ba$. Suppose that the result holds for all $n \geqslant 2$ and that $|u| + |v| = n+1$. Without any loss of generality, we may assume that $|v| \leqslant |u|$ and $|u| \geqslant 2$, so that $u = u'c$, with $|u'| = |u|-1$ and $c$ is the last letter of $u$ (either $a$ or $b$). Now
$$
uv = (u'c)v = u'(cv) \stackrel{\color{red}{(1)}}{=} u'(vc) = (u'v)c \stackrel{\color{red}{(2)}}{=} (vu')c = v(u'c) = vu
$$
$\color{red}{(1)}$ By the induction hypothesis, $cv = vc$, since $|v| + |c| = 1 + |v| < |u| + |v| = n$.
$\color{red}{(2)}$ By the induction hypothesis, $vu' = u'v$, since $|u'| + |v| = (|u|-1) + |v| = n$.
Answer: Your proof is incomplete. In second induction you should take $n = k'$. For $n = k', m = 1$ it is true from 1st induction and now you should prove for $n = k', m = k+1$ assuming it is true for $n = k', m= k$.


Best way to visualize predictions from a linear model

Question: Let's say I'm doing some predictive analytics and am trying to predict US GDP per month using a two or three month lag. After every month, I generate new predictions and am able to compare my prediction to the actual gap. What would be the best way to represent this via plot. Line chart?
In all the research I've done, there doesn't seem to be a 'standard' way to visually represent time series predictions compared to the actual values over time.
Answer: Typically line graphs are used to represent trends. Alternatively, if your primary goal is to display the accuracy of your model, and if you have enough data, you could do a histogram of the differences between predicted and actual.
Answer: An addition to the histogram of the errors, is a plot of the errors over time. With the histogram you can't check the correlation of the error terms. In case the error terms are somehow correlated, you know your model can be improved.


Guitar Fingerings for susb9 chords?

Question: This chord goes well with Phrygian Mode and second mode of Melodic Minor.
From Mark Levin's Jazz Theory Book: "The Notes most often played on a susb9 chord, .. , are root, b9, 4th, 5th, and 7th. This will yield for Esusb9 those notes: E,F,A,B,D.
So do you have any practical fingerings on fretboard for susb9 chords?
Answer: A chord position for your example would be 0-2-3-2-3-0.  You can move this up the neck by not playing the sixth string and wrapping you thumb around to fret the first string, e.g. 2-4-5-4-5-x for F#sus♭9.
You could voice F#sus♭9 as 2-2-2-1-2-2, or 2-2-2-1-2-0 to increase the presence of the ♭7.  They can be played up the neck depending on your reach and how good you are at partial barres.
Gsus♭9 could be 3-3-0-1-1-1.  You will have difficulty barring it but could just play x-x-2-3-3-5 for Asus♭9 for example; moving the root high and dropping the ♭7, which could still result in a workable sound depending on your purpose.  If you have a large reach you could instead drop the fourth by playing x-x-2-3-8-5.
Asus♭9: x-0-0-4-5-3.  Naturally this goes up the neck very nicely if you can reach for the barre.
A#sus♭9: x-1-1-1-0-1, also quite easy to play higher.  Notice that if you tune your fifth string down one semitone, Asus♭9 becomes x-0-0-0-0-0.
You can of course make variations by dropping some notes (the fifth is easiest to drop while maintaining a good sound) or using ♭2 instead of ♭9 (i.e. adding it in earlier/lower, such as 5-2-0-0-1-0 for Asus♭9). You could also start with the ♭7 -- e.g. 3-0-0-4-5-3 for Asus♭9 -- or another note, though it will certainly give the chord a different flavor.
Comment: Note that I didn't get into the Melodic Minor chords that use a 6th, since the question seemed focused on the 1-4-5-♭7-♭9 version.
Answer: Are you doing 9 chords or b9 chords. It looks like some of those (e.g. -x-0-0-4-5-3) are hitting the 9th and not the b9th. To change the example chord, all you have to do is flat the note on the 3rd string (-x-0-0-3-5-3-) which is an easier chord to move around the neck in my opinion.

Guitar Fingerings for susb9 chords?


How to deal with the extreme reverberation in big cathedrals when playing the pipe organs?

Question: While playing the pipe organs in cathedrals or churches with huge echo/reverberation, I noticed that along with the delay/latency (when the pipes are not close enough to the ears) comes the second problem: the reverberation.
How does the organist deal with that?
In my experience I noticed that if I slow down the tempo, that helps a little bit, but I have the feeling that is not enough and may not work always.
On YouTube I noticed an organist was shortening the note durations (playing them as staccato), making the sound a bit clearer.
Are there any specific techniques to make the melody clearer while playing in such big cathedrals? Could it be that in the place designed for the public the sound is clearer than where the organist plays?
Answer: Organists are one of the very few groups of musicians who have to learn not to listen to what they are playing, because (except for situations where a detached playing console is in the middle of the building) what they hear while playing has no resemblance to what the audience is hearing.
Even with a relatively small pipe organ with the console "built in" to the instrument, what the organist hears is heavily muffled by the structure of the organ case (which is designed to project the sound over his/her head!) and the tonal balance of different stops will be distorted by their different physical locations in the instrument.
If you are faced with an unfamiliar instrument, one option is simply to listen to someone else playing, from the audience's position. At least with modern communication technology like cellphones, you don't have to try to shout instructions to each other over the noise of the instrument!
The technical solutions to the problem are mainly articulation and registration. If you ensure the frequency spectrum if the "melody" and "accompaniment" are sufficiently different, the melody will be heard as such. This is actually a similar technical problem to mixing recorded music.
The non-technical solution is to choose your music carefully. Specifically, music written by composers who were also organists is more likely to work than arrangements of non-organ music made by non-organists. Whatever period of music you choose, Bach, Couperin, Mendelssohn, Franck, Widor, Messiaen, etc wrote "organ music that works" - and often is very hard to arrange successfully for any other medium.
Comment: However, arrangements of non-organ music by organists may work. Some of the Englishman [Edwin Lemare's](https://en.wikipedia.org/wiki/Edwin_Lemare) arrangements are rather good (if fiendishly difficult!)
Comment: and to some extent, if the room acoustics are rotten, you and the audience are stuck with the results :-( .
Answer: The tempo is adjusted to the acoustics of the room - faster for a dry room, slower in a wet (resonant) acoustic. Articulation helps - and a good set of reeds, which are extravagantly deployed in cathedral and basilica instruments.
In English cathedrals, the organ is frequently on the 'screen' separating nave from the choir, essentially placing the organ in the middle of the room. Oftentimes, when the organ is in (or adjacent to) the choir, the organ might have a chamber that speaks directly into the nave, or there might be an antiphonal division to assist a congregation.
Now consider the 'state trumpet,' the party horns, at the back of the immense acoustic of the Cathedral Church of St John the Divine in NY - almost a full city block away from the choir! It takes about half a second for the sound at the back to propagate to the front.


save node after paypal payment success

Question: In my projects, Whenever Authenticated user create new content(page) they should redirect to paypal for done payment when they click save. Once Payment Success Node should be save otherwise its should not save.
Please help me for Fix this concept.
Thanks in Advance
Answer: Get the response from Pay-pal if the response code is 200 save the node otherwise don't save it.
for example :
<code>if ($responseCode == 200){
  //node_save($node);
}
else {
  print "payment failed";
}
</code>
https://www.drupal.org/node/1207878
check this for more info only for condition to check the payment status.
Comment: In my project User can add Advertisement. So i have created one content type called Advertisement. Whenever Authenticated user want to add new Advertisement they can create but when they click save button its should goto paypal. once payment done advertisement can publish otherwise that advertisement should not.

So i have no idea for implement this. can anyone help me??

save node after paypal payment success


adding links in javascript based table field

Question: The only thing I could find on the net how to do this is here and I am still stumped, cant figure it out.
I basically have a javascript based table and I want some fields to contain a link with either an image or a simple glyphicon.
For instance fields sheet1,sheet2,sheet3I want to contain an image or glyph of a PDF icon since they are PDF's and so on which will link to the actual file.
Most of the articles I find on how to do this are with static tables, since mine is dynamic I am having a hard time finding info on this.
I just cant figure out where to even start with this, any ideas that can point me in the right direction would be awesome.
jquery/bootstrap
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();

    $('#table-javascript').bootstrapTable({
        method: 'get',
        url: 'bootstrap_database.php',
        height: 600,
        cache: false,
        striped: true,
        pagination: true,
        search: true,
        pageSize: 20,
        pageList: [20, 40, 60, 100, 200],
        minimumCountColumns: 2,
        clickToSelect: true,
        columns: [{
            field: 'title',
            title: 'Title',
            align: 'center',
            sortable: true
        },{
            field: 'audio',
            title: 'Audio',
            align: 'center',
            sortable: true
        },{
            field: 'sheet1',
            title: 'Sheet 1',
            align: 'center',
            sortable: true
        },{
            field: 'sheet2',
            title: 'Sheet 2',
            align: 'center',
            sortable: true
        },{
            field: 'sheet3',
            title: 'Sheet 3',
            align: 'center',
            sortable: true
        },{
            field: 'lyrics',
            title: 'Lyrics',
            align: 'center',
            sortable: true
        },{
            field: 'sheet1notes',
            title: 'Notes 1',
            align: 'center',
            sortable: true
        },{
            field: 'sheet2notes',
            title: 'Notes 2',
            align: 'center',
            sortable: true
        },{
            field: 'sheet3notes',
            title: 'Notes 3',
            align: 'center',
            sortable: true
        }]
    });
});

HTML

Music

Comment: Please see ["Should questions include "tags" in their titles?"](http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles), where the consensus is "no, they should not"!
Answer: Here is the example: http://issues.wenzhixin.net.cn/bootstrap-table/,
to use formatter column option: https://github.com/wenzhixin/bootstrap-table-examples/blob/master/welcome.html#L98