Minimizing the risk of misfires and duds in a missile control system

Question: I was thinking the other day about all the different ways humanity could end itself -- I won't depress you all by listing them here -- and misfired nuclear missiles came to mind. The problem below is about how to minimize misfires and duds through distributed components and backups. The explanation runs a little long but the problem is complicated (though the mathematics is not) so I wanted to be clear.
Background
In designing a missile defense system, there are two important qualities you must have: reliability and security. By reliability I mean that the system doesn't fail when it is needed, and by security I mean that the system doesn't fire when it isn't supposed to. (And of course there are other important qualities to design for, such as accuracy, but I'm not considering those here.)
To make a system reliable, one solution is to have a number of backups for each component, so that only one of these need be functioning for each component to make the whole thing work.
To make a system secure,  we can't simply make a long series of software tests that need to be passed, because in the end if you have only one component which needs to activate in order for the whole thing to go off, one flipped bit could shoot a missile accidentally. (Perhaps this isn't really true but this is what I'm assuming for the problem.) Given this, we want to have a number of different mechanical components, say $ C_1, C_2, \ldots $ which all need to be activated in order for the firing mechanism to succeed.
However there is a slight problem. The more components we have to ensure security, the more backups we need to ensure that all of them function properly. And the more backups we get to ensure reliability, the higher the chance one backup for each component fails.
Assume that they do not need to all fail at the same time, but rather once a bit is erroneously flipped in one backup of one component, it stays flipped for some time period T until someone comes along and replaces it. The longer the time period T, the more likely that one of each of the different components will fail, creating a misfire if they all do.
The Problem
Here is the question. Let $ S $ be the number of different components to ensure security,  and let there be $ R $ backups of each of these components to ensure reliability. Assume that the failure rate of any one (backup of a ) component during a time period $ T $ is $ P_f $. Let $ P_m $ denote the probability of a misfire and let $ P_d $ denote the probability of the system failing to fire. (The letter $ d $ is for "dud".) Let $ P_s = \sqrt {P_m^2 + P_d^2}$ denote the total probability of system failure.
What values of $ S $ and $ R $  give the lowest probability of a system failure $ P_s $ over the time period $ T $?
In other words, how many different components and how many backups for each of those components should there be to minimize the risk of either a misfire or a failure to fire?
Comment: Shouldn't the probability of at least one kind of failure in a period $T$ be $1-(1-P_m)(1-P_d)$?
Comment: I'm not sure where $\sqrt{P_m^2 + P_d^2}$ came from ...
Comment: I think you're right. That's probably a more traditional and accurate measure. I'll edit.
Comment: @Zubin one thing that my original measure captures that the revised one doesn't is the idea that a 100% probability of misfires and a 0% probability of duds isn't as bad as a 100% probability of both kinds of failures. The $\sqrt {P_m^2 + P_d^2}$ measure does capture that. Should I change it back?
Comment: Hmm, it depends on what you want with "total probability." If you want the probability of "at least one kind of failure" then 1 misfire and 1 dud will be counted the same as 1 misfire and 0 duds ... If, however, you want the [*expected number*](http://en.wikipedia.org/wiki/Expected_value) of failures of any kind, then that'd be something different (although I suspect it still wouldn't be $\sqrt{P_m^2 + P_d^2}$) - I guess I'm not sure what you mean when you say "total probability."
Comment: You could characterize the probability distribution on the number of failures quite well if you used two expressions: one for the [mean or expected value](http://en.wikipedia.org/wiki/Mean) of the number of failures, and one for the [standard deviation](http://en.wikipedia.org/wiki/Standard_deviation).
Comment: I'm not well versed in anything more than basic probability so I'm probably not the best to decide. I'll change it back to the original for now since that captures the equal importance of avoiding both types of failures a little better.
Answer: You need to specify how they are hooked up carefully to calculate the probability, but you can always improve things with more components.  One way to connect them is to have $R$ components in parallel and $S$ batches of parallel groups in series.  Now you fire if at least one component in every group works and don't fire if at least one group has a component that doesn't.  Then when you want to fire, the chance that one group does is $1-(1-P_d)^R$ and the chance that all the groups do is $[1-(1-P_d)^R]^S$  The chance of a misfire of one group is $1-P_m^R$ and the chance of a system misfire is $(1-P_m^R)^S$.  If you increase $R,S$ together, you increase the chance of always having desired behavior.
Of course, this assumes all failures are random.  As the chance gets closer to what you want, the dominating failures are common ones-sending the fire signal when you don't want to, which then is executed successfully.  Oops!


Does $\mathbb E[\varphi (x,Y)]|_{x=X}=\mathbb E[\varphi (X,Y)\mid X]$ always hold?

Question: I proved in an exercise that $$\mathbb E[\varphi (X,Y)\mid \mathcal G]=\mathbb E[\varphi (x,Y)]|_{x=X},$$
and thus, by unicity of the conditional expectation, $$\mathbb E[\varphi (X,Y)|\mathcal G]=\mathbb E[\varphi (X,Y)|X]=\mathbb E[\varphi (x,Y)]_{x=X}.$$
But I was wondering, does $$\mathbb E[\varphi (X,Y)|X]=\mathbb E[\varphi (x,Y)]_{x=X}$$
always hold or not ? I strongly suspect that no, but I can't find a counter example. Any idea ?
Comment: It holds when $X$ and $Y$ are independent.
Comment: What does $\mathbb E[\varphi (x,Y)]_{x=X}$ mean?
Comment: @Fimpellizieri : $$\int_\Omega \varphi (X(\omega ),Y(\omega '))\mathbb P(d\omega ')$$
Answer: The identity holds for independent random variables $X$ and $Y$. If $X$ and $Y$ are not independent, then it is in general wrong.
Take a square-integrable random variable $X \neq 0$ with mean zero and set $Y=X$, $\varphi(x,y)=xy$. Then
$$\mathbb{E}(\varphi(X,Y) \mid X) = \mathbb{E}(X^2 \mid X) = X^2.$$
On the other hand, $$\mathbb{E}(\varphi(x,Y)) = \mathbb{E}(x X) = x \mathbb{E}(X)=0$$
and so$$\mathbb{E}(\varphi(x,Y)) \big|_{x=X} = 0.$$


Expressing P(XY > K) in terms of P(X > a, Y > b)?

Question: I'm trying to express the value $P(XY > K)$ in terms of $P(X > a, Y > b)$ for some values of $a$ and $b$ that are probably related to $K$.  I'm generally looking for a formula where $P(X > a, Y > b)$ is present in some form or other - it's fine if it's inside an integral or whatnot.
I've tried $\int_{0}^{\infty} P(X > z, Y > K/z)dz$, but this seems to overcount by quite a lot.  Any advice on how I can express this value in the desired format?
Comment: $XY > K$ does not necessarily mean $X>z , Y>K/z$. As an example let K=100. From ($X>z , Y>K/z$), $X>10$ means $Y>10$. However,  $X>10$ also contains $X=20$ and in this case $Y>5$ is enough (but it is assume that $Y>10$)
Answer: Remember that $$f_{X,Y}(x,y)=\frac{\partial}{\partial x}\frac {\partial}{\partial y} F_{X,Y}(x,y)=\frac{\partial}{\partial x}\frac {\partial}{\partial y}\mathbb{P}(X<x,Y<y)$$
Then $$\begin{align} \mathbb{P}(XY>k)&=\iint_{xy>k}f_{X,Y}(x,y)\mathrm{d}x\mathrm{d}y \\ &=\iint_{xy>k}\frac{\partial}{\partial x}\frac {\partial}{\partial y}\mathbb{P}(X<x,Y<y)\mathrm{d}x\mathrm{d}y\end{align}$$
The integral bounds will depend on the supports for both $x$ and $y$.
Answer: Since X and Y are independent events, $$ P(XY>K)=P(X>z \text{ and } Y>K/z)=P(X>z)\,P(Y>K/z). $$
So summing over all possible $z$ gives as a limit the integral
$$P(XY>K) = \lim_{t\to0^+}\int_t^{1/t}{P(X>z)\,P(Y>K/z)\,dz}$$
(we need the limit with $t$ because we cannot divide by $0$ in $K/z$).
Comment: $X$ and $Y$ are random variables, not events, and nowhere does it say that they are independent.


How to correctly install a humbucker (electric guitar) pickup cover?

Question: I'm planning to cover up an open coil humbucker, with a cover that has no holes exposing the slugs, that looks something like this (it's simply easier to keep clean):

I watched this video on the subject, as far as I understand the process explained here is:

Create a barrier between the plastic top/slugs and the cover using wax
Insert the pickup
Solder on both sides of the back
Functionally we are done

What I don't understand, is what are we trying to achieve with the wax?

Are we trying to prevent conductance between the cover and the slugs in the pickup?
Or are we trying to make sure the pickup doesn't rattle in the cover (budget wax potting)?

Thanks for any info!
Comment: Is that cover non-ferrous?
Comment: @Tetsujin I'm not sure what that means? It's a normal nickel or chrome cover (without holes).
Answer: The goal is to prevent the cover from rattling against the pickup. It's not "budget wax potting". The coils should be waxed regardless, and probably (hopefully!) already are.
I'm not sure if there is much significance in grounding the slugs or not (since you ground the cover), especially if they are hidden under the cover, so you can't touch them (touching ungrounded slugs may cause noise).


Least Upper Bound Property

Question: Note that a non-empty set which is bounded above always has a least upper bound, by Axiom the completness axiom. However, it need not have a maximum.
My question is that why not need have a maximum?
Answer: Take for example the set $(a,b)\subset \mathbb{R}$ where $a<b$. This set is nonempty and has least upper bound $b$. But since this set does not include the endpoints it does not have a largest element since we can get arbitrarily close to $b$.
Comment: You're welcome.
Answer: Think an open or semiopen interval, for example [0,1) 1 is the supremum of this set for > relation, but can´t be the maximum because it is not in the set. Anyway, if the least upper bound it is in the set, then it is his maximum, of course. In discrete sets:natural, integers numbers, etc....the least upper bound is always the maximum.
Answer: First let me make you clear what is maximum of a POSET.Maximum is that element of a POSET which is in the set and is greatest of all the element of the set. So completeness axiom only tells you about the LUB(or GLB) and not about the maximum(or minimum).
For example, take the set (0,1) according to completeness axiom it has a supremum i.e., 1 but it doesn't have any maximum cause you cannot find the maximum element in the set. If you assume 0.999999999 as the maximum, i can provide another number 0.999999999999(say) which is larger than the number that you provided. Similarly, someone else can provide another number 0.999999999999999999(say) which is again larger than the number i provided to be the maximum. So, its a game that doesn't ends. Thus it doesn't have any maximum.

Least Upper Bound Property


Power Pivot Calculated field (Teradata)

Question: I imported data from teradata through a query in powerpivot data model. But I am unable to add a calculated field with absolutely any formula using table columns.
I tried
Calculated Field 1:=Query[AccountsWithOffers]

But even this didn't result in anything.I am receiving a Semantic Error 'accounts with offer cant be determined.
My table columns are
touch_date
area
region
channel
OfferMade
AccountswithOffers

Answer: Calculated Fields (or "Measures") cannot reference "naked" columns. There must be an aggregation of data to return a single, well-defined result from the filter context. COUNT(Query[AccountsWithOffers]) should return a result if Query[AccountsWithOffers] is a numeric field. If it is not COUNTA(Query[AccountsWithOffers]) will work.

Power Pivot Calculated field (Teradata)


In memory class generation with attribute and methods

Question: Hey this is a conceptual question and create some curiosity in my mind that is it possible to create Class(not object) dynamically or in memory? and also we can define attributes and methods for this class dynamically as well.
Is this possible in any oops language ?
Answer: Yes, it is possible in .NET.
Look at System.Reflection.Emit namespace. Using types from it you can dynamically build assemblies and types in them.
Answer: Yes you can do it using java Reflection API .
Answer: Yes, it's doable in Java; the technique is generally referred to as bytecode generation.  Libraries like cglib make it more doable, albeit it's going to be pretty complicated however you do it.


Can't add render callback to output unit

Question: I'm writing an app that should mix several sounds from disk and save resulting file to disk. I'm trying to use Audio Units.
I used Apple's MixerHost as a base for my app. It has Multichannel mixer connected to Remote I/O. When I'm trying to add render callback to remote IO I've got error -10861 "The attempted connection between two nodes cannot be made." when call AUGraphConnectNodeInput(...).
What I'm doing wrong? What's the right way to mix and record file to disk?
callback stub:
static OSStatus saveToDiskRenderCallback(void *inRefCon,
                                     AudioUnitRenderActionFlags *ioActionFlags,
                                     const AudioTimeStamp *inTimeStamp,
                                     UInt32 inBusNumber,
                                     UInt32 inNumberFrames,
                                     AudioBufferList *ioData)
{
    return noErr;
}

adding callback to Remote I/O Unit:
    AURenderCallbackStruct saveToDiskCallbackStruct;
saveToDiskCallbackStruct.inputProc = &saveToDiskRenderCallback;

result = AUGraphSetNodeInputCallback (
                                      processingGraph,
                                      iONode,
                                      0,
                                      &saveToDiskCallbackStruct
                                      );

error here:
    result = AUGraphConnectNodeInput (
             processingGraph,
             mixerNode,         // source node
             0,                 // source node output bus number
             iONode,            // destination node
             0                  // desintation node input bus number
         );

Answer: You are confused on how audio units works.
The node input callback (as set by AUGraphSetNodeInputCallback) and the node input connection (as set by AUGraphConnectNodeInput) are both on the same input side of your remote IO unit.  It looks you believe that the input callback will be the output of your graph.  This is wrong.
AUGraph offers two paths to feed the input of an AudioUnit:

Either from another upstream node (AUGraphConnectNodeInput)
or from a custom callback (AUGraphSetNodeInputCallback),

So you can't set them both simulatenously, it has no meaning.
Now two possibilities
1) Real time monitoring
This is not what you describe but this is the easier to get from where you are.  So I assume you want to listen to the mix on the Remote I/O while it is being processed (in real time).
Then Read this
2) offline rendering
If you don't plan to listen in real time (which is what I understood first from your description), then the remote IO has nothing to do here since its purpose is to talk to a physical output. Then read that.  It replaces the remote I/O unit with a Generic Output Unit.  Be careful that the graph is not run in the same way.


AES c# encoding. Can't get valid result

Question: I have test input string (key=value&key=value...) and key (like this D2335A9CA4924D9F914D2B47B450D436)
I need to Encrypt my string using AES encryption but my result is not equal to provider's result. Result example :
AD0C66FB3C1204A8B0AC68AA9B9E3029C86DFF5872753F2F8D7B68EA667D8616215C20F831ABD5A4D56F286E471651AE5C15BCEB2F368200B4D9F3F6D2F0791E8F45D45FD ....................
What I'm doing wrong? (googlized code)
public static string Encrypt(string toEncrypt)
        {
            byte[] keyArray = ASCIIEncoding.ASCII.GetBytes("D2335A9CA4924D9F914D2B47B450D436");
            byte[] toEncryptArray = ASCIIEncoding.ASCII.GetBytes(toEncrypt);
            RijndaelManaged rDel = new RijndaelManaged();
            rDel.Key = keyArray;
            rDel.KeySize = 128;
            rDel.BlockSize = 256;
            rDel.IV = keyArray;
            rDel.Mode = CipherMode.CFB;
            rDel.Padding = PaddingMode.PKCS7;
            ICryptoTransform cTransform = rDel.CreateEncryptor();
            byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
            return FormatByteArray(resultArray);
        }

        internal static string FormatByteArray(byte[] b)
        {
            System.Text.StringBuilder sb1 = new System.Text.StringBuilder();
            int i = 0;
            for (i = 0; i < b.Length; i++)
            {
                if (i != 0 && i % 16 == 0)
                    sb1.Append("\n");
                sb1.Append(System.String.Format("{0:X2} ", b[i]));
            }
            return sb1.ToString();
        }

Answer:
What I'm doing wrong?

byte[] keyArray = ASCIIEncoding.ASCII.GetBytes("D2335A9CA4924D9F914D2B47B450D436");

This can't be right. It'll give you 64 bytes, half of them 0x00.
It looks like it's Hex encoded, I think you'll need a little loop to decode it.
That would give you 16 bytes (128 bits).

Old answer:

You need to decode this string, it probably is Base64 encoded. Try:
byte[] keyArray = System.Convert.FromBase64String("D2335A9CA4924D9F914D2B47B450D436")

And check if you have a valid (length) key.
Comment: Maybe hex, not base64?  If so, see http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa-in-c
Comment: @adrift, Yes, I was already editing. And that link is helpful too.
Comment: @ars - nothing should be dynamic, you just have to work accurately, and you need to _know for sure_ what the other side uses: ASCII, 128, 256, IV == key, CFB, PKCS7. Get 1 wrong and you have a different result.
Comment: The result should be a multiple of BlockSize. Could be that the other string contains other/more padding. The real test would be to write the Decrypt() mirror function and see if you get your original string back.
Comment: thanks guys. I've done this but the result anyway is not correct. And any building this code brings new result. I guess some parameters are dynamic.
Comment: @Henk - I've did what you said. End the result is become better. But anyway my result string shorter. It's strange for me because winmerge shows that my result is sub string of correct result. I'm using the same key and input string with provider.
Comment: Thanks Hank Your advices was helpful.

AES c# encoding. Can't get valid result


WCF Service Operation doesnt start until i try to access it from client

Question: I have a wcf service (wsDualHttpBinding)  i changed it from BasicBinding to wsDualHttpBinding in order to support events , i implemented the callback contract and everything here is the attribute on my service Contract:
<code>[ServiceContract(
    SessionMode = SessionMode.Required,
    CallbackContract = typeof(IServiceCallBack))]
</code>
now problem is : when i start the service it runs and everything is ok except its operation doesnt get started ! , now if i opened the client and try to call any method in the service it gets started and the operations gets started although the method i called has nothing to do with the operations at all.
also it used to work normaly before i change wsDualHttpBinding.
it looks like the service doesn't get instantiated untill a session open with the client.
the WCF service is hosted in a console application.
I have a list of ports to open if their auto-start set to true , in the constructor of the WCF service i get the ports from the database and check if any is auto-start and i open it , the wcf service expose features like adding new ports and removing ports and editing etc etc
any way to fix that ?
thanks in advance.
Comment: WCF operation must be consumed by something, that's the whole point.. so I'm not sure what you're asking here. To have something executing automatically write windows application and have it Scheduled, or even better Windows Service that starts automatically.
Comment: its a windows service which does operations and open ports for listening and a wcf over it which administrate the windows service.
Comment: Still not much sense. How exactly you expect the operation to "get started"? What should start it?
Comment: I have a list of ports to open if thier autostart set to true , in the constructor of the WCF service i get the ports from the database and check if any is autostart and i open it , the wcf service expose features like adding new ports and removing ports and editing etc etc
Comment: its obvious that the service is running On-Demand now just like if im hosting it on IIS although im hosting it in a console application i dont know why this is happening , also be aware it used to work when it used basichttpbinding but now that i changed it to dual it stoped working.
Comment: I'm still in the dark, sorry.. what you mean "it used to work"? The operation executed all by itself?
Comment: yes Shadow , it used to execute by it self once i start the host-service , which means the WCF used get instantiated once the service host get started.
Comment: can you provide the code that you use to start the ServiceHost(s)?
Answer: WCF services running in IIS are not started until they are called. If you are running the latest (currently v7.5) version of IIS, then you can use the AppFabric auto-start feature, described here and demonstrated here.
Comment: im hosting it in a console application !
Comment: since you're hosting it in a console application, can you please provide the code that you use to start the ServiceHost(s)?
Comment: var _ReceiverHost = new ServiceHost(typeof(Controller));
_ReceiverHost.Open();
Answer: I am doing the same kind of thing to administer a background application.
Make sure your host can still instantiate your service. If you changed the binding name, maybe your host can no longer find it.


SSL certificate fail apache

Question: I have setup a certificate on Apache server. When I access my site's https pages, I see the certificate flashing (in FireFox's url tab) and disappearing immediately.
The browser stays in the same windows (https) but now certificate info is not displayed and the connection is not encrypted.
Can anyone recommend on how I can even start checking what is wrong ?
(Certificate fail ? Bad config ?)
Thanks
Answer: See http://www.sslshopper.com/article-stop-the-page-contains-secure-and-nonsecure-items-warning.html for information on how to fix this problem.
Answer: Not a server issue.
Apparently the site was serving scripts for an http address.
FYI for everyone having same problem.

SSL certificate fail apache


OpenVPN with same subnet on two remote sites

Question: i have some issue with an OpenVPN concentrator while using TUN device.
The scenario is that:
OpenVPN Server
VPN Subnet: 10.10.10.1/24

PC1 OpenVPN Client
VPN IP: 10.10.10.50
PC Local subnet/IP: 192.168.20.100

PC2 OpenVPN Client
VPN IP: 10.10.10.60
PC Local subnet/IP: 192.168.30.100

RemoteSite1
VPN IP: 10.10.10.70
Local Subnet: 192.168.80.0/24

RemoteSite2
VPN IP: 10.10.10.80
Local Subnet: 192.168.80.0/24

The PC1 connect to RemoteSite1 and the PC2 connect to RemoteSite2 but while using iroute one of the PCs reach the wrong remote site.
This setup works perfectly while using TAP device. In order to avoid the network conflicts on the OpenVPN server there are not the routing rule for the remote sites, there is a specific lookup routing table for each PC like that:
root@openvpn~ # ip rule sh
0:  from all lookup local
1:  from 10.10.10.50 lookup 1024
1:  from 10.10.10.60 lookup 1034
10: from all to 10.10.10.0/24 lookup main

And under each table:
    root@openvpn~ # ip route show table 1024
    192.168.80.0/24 via 10.10.10.70 dev tap0
root@openvpn~ # ip route show table 1034
192.168.80.0/24 via 10.10.10.80 dev tap0

How can archieve the same setup but with TUN and iroute?
Answer: I don't think you can do that.
TUN is routed (OSI layer 3), and it isn't possible to have two identical routes for a single subnet in this way (you would need at least some kind of difference in metric).
TAP operates at OSI layer 2, where MAC lookups are possible, which is how your setup is working (when it works).
For TUN to work in this situation, your best bet might be to split your /24 into two /25 networks, and assign one side to each location.
Comment: I can confirm that you can't  have two identical routes for a single subnet when TUN is routed (OSI layer 3). Also, if you need to bridge two ethernet segments in two different locations - then use tap. in such setup you can have computers in the same ip subnet (eg 10.0.0.0/24) on both ends of vpn, and they'll be able to 'talk' to each other directly without any changes in their routing tables. vpn will act like ethernet switch. this might sound cool and is useful in some cases but I would advice not to go for it unless you really need.
Comment: @iwaseatenbyagrue thank you very much for the explanation, yes with TAP this setup always work. I have a VPN concentrator with almost 300 Clients (eWon gateways) that have an older version of OpenVPN < 2.2 and so I need to do this trick because the network mapping is not supported.
I have another VPN concentrator with 650 Clients that have OpenVPN 2.3 and I don't need to do this trick because I can use the network mapping and the use on the VPN concentrator side and I can do a normal routing rules.


Why is the unit vector perpendicular to the position vector given by $\frac{y\hat{i} - x\hat{j}}{\sqrt{x^2+y^2}}$

Question: Why is the unit vector perpendicular to the position vector given by $$\frac{y\hat{i} - x\hat{j}}{\sqrt{x^2+y^2}}$$
Answer: Hint: $(a,b)$ and $(-b,a)$ are always orthogonal (rotation by $90^\circ$).
Comment: @Moshin, I think you just need to draw it and you will see, and never forget why.
Answer: Because
(1) $(x, y)\cdot(y, -x) = 0$,
so this is orthogonal to
$(x, y)$
and,
(2) the $\sqrt{x^2+y^2}$
make the length one,
so it is a unit vector.


Can the Lie group $\text{G}_2$ be exhibited as an intersection $\text{SO}(7) \cap H$ where $H \leq \text{SL}_7(\mathbb{R})$?

Question: The compact simple Lie group $\text{G}_2$ has a well-known faithful representation on $\mathbb{R}^7$, so we can regard $\text{G}_2 \leq \text{GL}_7(\mathbb{R})$.  Equipping $\mathbb{R}^7$ with the usual euclidean inner product, it turns out that $\text{G}_2 \leq \text{SO}(7)$.
My question is that in the title: Can we write $\text{G}_2 = \text{SO}(7) \cap H$, where $H \neq \text{G}_2$ is also a subgroup of $\text{SL}_7(\mathbb{R})$?
I would be very happy to hear that the answer is "yes," but strongly suspect that the answer is "no."
Addendum: More generally, I'd be interested in learning the existence of connected Lie subgroups $K$ with $\text{G}_2 < K < \text{SL}_7(\mathbb{R})$ other than $K = \text{SO}(7)$.
Comment: As per Ted Shifrin's suggestion: [As I'm sure you already know](https://chat.stackexchange.com/transcript/message/39580980#39580980) (see the conversation above that message), some papers by Bryant might contain some relevant information. I have looked at *Submanifolds and Special Structures on the Octonians* which doesn't seem to have anything directly relevant, though a lot of related stuff ($G_2$ as a subgroup of Spin(7), for instance). There are probably many other relevant papers by Bryant. But, again, you probably already know about those papers.
Comment: @Danu: Thank you (and Ted Shifrin) for the suggestions.  But yes, I've read that paper already :-)
Answer: This isn't quite a full answer, but it does answer your addendum (where you have added the word 'connected').
Under the action of $G_2$, the Lie algebra $\mathfrak{sl}_7$ decomposes as $\mathfrak{g}_2 \oplus \mathbb{R}^7 \oplus S^2_0(\mathbb{R}^7)$. Now, $\mathfrak{so}(7) = \mathfrak{g}_2 \oplus \mathbb{R}^7,$ so the only candidates for $\mathfrak{h}$ are $\mathfrak{g}_2$ and $\mathfrak{g}_2 \oplus S^2_0(\mathbb{R}^7).$ But $\mathfrak{g}_2 \oplus S^2_0(\mathbb{R}^7)$ is not closed under the Lie bracket. For example, $ [ E_{1,1} - E_{2,2}, E_{1,2}+E_{2,1} ] = 2 E_{1,2}-2 E_{2,1}$, which is not an element of $\mathfrak{g}_2 \oplus S^2_0(\mathbb{R}^7)$ (I'm using the standard definition of $G_2$ here of course). This shows that the identity component of $H$ is in fact $G_2$.
Comment: This basically does it, I think.  If there were an $H \leq \text{SL}_7(\mathbb{R})$ with $\text{G}_2 = \text{SO}(7) \cap H$, then of course $\text{G}_2 \leq H < \text{SL}_7(\mathbb{R})$.  Your argument shows that the identity component of $H$ is either $H^0 = \text{G}_2$ or $H^0 = \text{SO}(7)$, so $H$ is a disjoint union of copies of $\text{G}_2$ or copies of $\text{SO}(7)$.  Does that sound right?


Imprimir outra página com javascript

Question: Tenho um sistema do qual mostra o resultado de uma consulta. Nessa página tem o botão imprimir, porém preciso fazer com que ao clicar no botão imprimir, imprima uma outra página formatada sem ter que abrí-la para isso, ou se for o caso, fazer que nem acontece com download, abrir e fechar automaticamente. Tenho o seguinte código na página principal ( index.php ):

 Imprimir Orçamento

Comment: no lugar de usar o `window.open` você poderia usar um iframe para o trabalho.
Comment: Desculpe TobyMosque, não entendi
Comment: Você quer que imprima automaticamente?
Comment: Sim. Depois de clicar no botão imprimir, ele ler a página que vai ser impressa e logo em seguida fechar a página. Tipo o que ocorre em download de arquivos, onde abre, manda o arquivo e a página fecha automaticamente.
Answer: olha, neste caso é melhor você criar um iFrame para o conteúdo desejado, até pq o window.open pode vir a ser bloqueado pelo Browser.
var iFrame = document.createElement("iframe");
iFrame.addEventListener("load", function () {
  iFrame.contentWindow.focus();
  iFrame.contentWindow.print();
  window.setTimeout(function () {
    document.body.removeChild(iFrame);
  }, 0);
});
iFrame.style.display = "none";
iFrame.src = "imprimir.php";
document.body.appendChild(iFrame);

abaixo segue um exemplo funcional com um trecho de HTML qual quer inserido pelo usuário.

var taRawHtml = document.getElementById("taRawHtml");
var btImprimir = document.getElementById("btImprimir");

btImprimir.addEventListener("click", function (event) {
  var html = taRawHtml.value.trim();
  if (html) {
    var blob = new Blob([html], { type: "text/html" });
    var iFrame = document.createElement("iframe");
    iFrame.addEventListener("load", function () {

      iFrame.contentWindow.focus();
      iFrame.contentWindow.print();
      window.setTimeout(function () {
        document.body.removeChild(iFrame);
        URL.revokeObjectURL(iFrame.src);
      }, 0);
    });
    iFrame.style.display = "none";
    iFrame.src = URL.createObjectURL(blob);
    document.body.appendChild(iFrame);
  }
});
html, body, div, input, textarea {
  box-sizing: border-box;
}
html, body {
  width: 100%;
  height: 100%;
  padding: 0px;
  margin: 0px;
}

body {
  padding: 5px;
}

textarea {
  width: 100%;
  height: 240px;
}
Insira um trecho de HTML dentro do input abaixo:
<textarea id="taRawHtml">

Hello Wolrd

</textarea>
<input id="btImprimir" type="button" value="Imprimir" />

Infelizmente o exemplo acima não vai executar aqui no SO, devido a uma politica aplicada ao iFrame do Snippet, mas você pode ver ele em ação no seguinte JSFiddle

Imprimir outra página com javascript


How to understand if the points are constant around a line?

Question: I would like to understand how can I check if some points around a line have constant distance between the point and the line.
So image a normal chart(cartesian plane) with a line that is formed with points where its coordinates are: x > 0 and y > 0 so always numbers bigger then zero.
Then, when I have this line i need to check if the distances of a list of points(x,y) are constant. With "constant" I mean that the distance between the points and the line is similar. Example:
LINE: (x - y coordinates)
1 - 1
2 - 2
3 - 3
4 - 4
5 - 5
6 - 6

POINTS: (x - y coordinates)
1 - 1.1
2 - 1.9
3 - 2.9
4 - 4.2
5 - 5.1
6 - 5.8

How can I check if the difference between the point on the line and the point (of the list of points)  are constant?
Thanks
Answer: Project the data orthogonally onto the line and inspect the residuals.
In this case, where the reference line is given (independently of the data) as $y=x$, the projection is tantamount to plotting the points $\{((x_i+y_i)/2, y_i-x_i)\}$.  To illustrate, here are your points and the reference line:

Here is the derived plot:

You can now apply any test of homogeneity and independence of residuals you like, such as the Fligner-Killeen test or Breusch-Pagan test.  (Many such tests assume the first coordinate is fixed, not random, so they will be only approximately correct, but in general--at least when the data aren't terribly noisy--they should work fine.)
Comment: thank you for your answer, I have one doubt. I'm reading how FLigner-Killeen works and I found: http://stat.ethz.ch/R-manual/R-patched/library/stats/html/fligner.test.html I have to pass a "group" at the second parameter, what does it mean? thank you!
Comment: That's an interesting solution, but what are the alternatives that the BP test would have power against? I guess that you could test against a polynomial function of x, depending upon how many data points the OP has. I'm not familiar with the FK test that you mention.
Comment: @Charlie what do you mean with "you could test against a polynomial function of x" ? could you give me a simple example with R code?
Comment: @Dail, you need to specify the form of the BP test. The test requires that you regress the residuals on something. It could be just a constant term (the coefficient on this term should be exactly 0 if the line in question is from OLS on the points) or include other variables as well. No variables besides x were mentioned in the question (taking y to be the outcome, so it doesn't count), so the only other things that you could include in the model are functions of x---I suggested polynomial functions. The BP test judges whether the coefficients on these terms are 0.
Comment: @Charlie, do you know how to calculate OLS regression with R? I didn't find it, at the moment i use lm() (linear regression), is not good?
Comment: @Charlie Here, it's natural to regress the residuals (and their squares) against the linear coordinate, $(x+y)/2$ in this case.  The idea is to see whether there are any trends in the distance from the line as a function of distance along the line.
Comment: @whuber, did you see the link I wrote you in my first comment? Iwould like to try FK test but I don't understand what does it mean with "groups" do i have to subdivide my data in two groups?
Comment: @Dail yes, you need to divide the data into two or more groups.  This provides more flexibility than regressing the squared residuals against distance along the line.
Comment: @whuber do I have to follow a specific criteria to create the groups or can I only create N groups with the same number of points sequentialy? About BP I don't have to create group so can i only use a formula like the linear regression?


$f(x) = \ln(x+1)$ transformation, transform it to $f(x) = g(x)\ln(x)$

Question: $f(x) = \ln(x+1)$
Is there a way to transform the Equation above to a simpler one, that will include only $f(x) = g(x)\ln(x)$ kind of function?
Comment: but $\ln (x+1)$ is defined for $ x=0$, while $f(x)\ln (x)$ isn't
Comment: There is no "Equation above"
Comment: If you type \ln(x) instead of ln(x) it looks better: $\ln(x)$ vs $ln(x)$.
Comment: the function is $ln(x+1)$
Comment: ln(x+1) isn't an equation, neither is it a function if not defined else. It's a term. You have not defined f(x) = ln(x+1)
Comment: edited, I meant $f(x) = ln(x+1)$
Answer: If:
$$\ln (x+1) = f(x) \ln x$$
then:
$$f(x) = \frac{\ln(x+1)}{\ln x}$$
This cannot be simplified. You could write $f(x) = \log_x(x+1)$, but we generally use logarithms with constant bases (hopefully $e$, that's the simplest base) so it is not a good idea to do so.
Comment: There are no log rules that would apply. Anything that might "look" simpler would just be hiding details from you without actually being simpler, like sneaking the same variable into the base and the exponent.
Comment: So there is no way to simplify this function?


Why does "myFileInfo.IsReadOnly = false;" incorrectly set other attributes

Question: I had a problem copying a file because another business processes was setting the read only flag on either file. I didn't want to touch the source but always have the dest as read/write.
Here's the code I got to pared down to a simple console app:
using System.IO;

namespace TrialConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileSrc = "Src.txt";
            string fileDest = "Dest.txt";

            FileInfo destFileInfo = new FileInfo(fileDest);

            if (destFileInfo.Exists && destFileInfo.IsReadOnly)
                destFileInfo.IsReadOnly = false;

            Directory.CreateDirectory(destFileInfo.DirectoryName);
            (new FileInfo(fileSrc)).CopyTo(fileDest, true);

            destFileInfo.IsReadOnly = false;
        }
    }
}

To run this you also need to create a Src.txt in your working directory.
When I first run this nothing appears to happen. the Dest.txt doesn't appear. The second time it complains about the destination file being readonly.
It was only when I showed Hidden and System files in explorer that I could see the Dest.txt, but it had the attributes HSAO set (O means offline in NTFS).
Why are these additional attributes being set? How do I fix it?
Answer: First time round the destFileInfo is created before the file is copied, it doesn't exist and it's attributes are 'undefined'.
The code then copies the file so now it does exist with defined attributes, but the destFileInfo still has the old data.
When the IsReadOnly attribute is set all the attributes written back to the file in one go. Those that are undefined in the stale destFileInfo object end up getting set.
Second time round is just the expected errors trying to overwrite a hidden system file.
The solution is to call destFileInfo.Refresh(); after copying the file.


What is a good example of a proof whose technique is extreme overkill for the problem being solved?

Question: What are some proofs that are inappropriately powerful for the problem being solved? (Something like the math equivalent of using an atom bomb to kill a spider)
Comment: There is a whole post on that [mathoverflow.](https://mathoverflow.net/questions/42512/awfully-sophisticated-proof-for-simple-facts)
Comment: $\sqrt[3]{2}$ is irrational.  Suppose not.  Then there are $p,q\in\mathbb{Z}$ such that $$\sqrt[3]{2} = p/q \implies 2 = p^3/q^3 \implies q^3 + q^3 = p^3, $$ which contracticts Fermat-Wiles.
Comment: Like this: https://math.stackexchange.com/questions/648273/prove-by-induction-that-22n-1-is-divisible-by-3-whenever-n-is-a-positiv/1622941#1622941?
Answer: Problem: Prove that, for each $n\in\mathbb{N}\setminus\{1\}$, $\sqrt[n]{2}$ is irrational.
Proof: There is a very well-known proof for the case $n=2$. Suppose that $n>2$. If there were two natural numbers $p$ and $q$ such that $\sqrt[n]2=\frac pq$, then$$p^n=2q^n=q^n+q^n.$$This is impossible by Wiles' theorem (a.k.a. Fermat's last theorem).
Comment: @JoséCarlosSantos let's email wiles and ask him ;)
Comment: But you have to make sure we can prove FLT without using the irrationality of $2^{1/n}$ anywhere.
Comment: @user37208 I would be amazed if the proof used that fact, but I must admit that I did not check it.
Comment: Bah! Beat me to it by 20 seconds (and in greater generality).  ;) (+1)
Answer: Russell and Whitehead's proof that $1+1=2$ that took several hundreds of pages of lemma's in Principia Mathematica comes to mind.
I don't know if inappropriate is the right word in this case, since of course the very idea of P.M. was to show that you can build a lot of mathematics on top of very elementary axioms of logic and set theory, but it definitely feels like shooting a mice with a cannon.


Windows 10 UWP app c# Print

Question: I want to print from a Windows 10 UWP app. In addition I have formatted the text as follows:
<RichTextBlock xml:space="preserve" x:Name="TextContent" Grid.Row="1" Width="675" OverflowContentTarget="{Binding ElementName=FirstLinkedContainer}" FontSize="18" IsTextSelectionEnabled="True" TextAlignment="Left" VerticalAlignment="Top" HorizontalAlignment="Left">
        <Paragraph>
            <InlineUIContainer>
                <StackPanel>
                    <Border Padding="2" BorderBrush="Black" Width="675" Height="Auto" BorderThickness="1">
                        <StackPanel Orientation="Horizontal" Margin="5,0,0,0" Height="20">
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                            <TextBlock Text="text 12345" Width="105" FontSize="14" FontWeight="Bold"/>
                        </StackPanel>
                    </Border>
                </StackPanel>
            </InlineUIContainer>
        </Paragraph>
    </RichTextBlock>

In the print preview the width wrong information the XAML TextBlock. The texts represented pulled apart.
How can I create a print page in XAML for Windows 10 print preview? Any help on this?
Comment: Workarround: With negative margins can align the texts provisionally reasonably
Answer: I don't really understand what you mean by

The texts represented pulled apart.

Maybe it's because you used StackPanel Orientation="Horizontal" instead of StackPanel Orientation="Vertical"?

Windows 10 UWP app c# Print


Combining discrete and continuous random variables

Question: Here is the question:

$X$ has the distribution $\mathcal{N}(0,1)$ and $Y$ is such that $P(Y=1) = P(Y=-1) = \frac{1}{2}$
Suppose that $X$ and $Y$ are independent and that $Z = XY$. Are $Y$ and $Z$ independent? Are $X$ and $Z$ independent?"

I think that $Z$ has to follow a $\mathcal{N}(0,1)$ distribution since
$P(Z=z) = P(XY=z) = P(X=z)P(Y=1)+P(X=-z)P(Y=-1) = P(X=z)$ for all $z$
but not sure where to go from here when proving whether or not $Y$ and $Z$ (or $X$ and $Z$) are independent.
Thanks
Comment: Take a look at this: http://en.wikipedia.org/wiki/Normally_distributed_and_uncorrelated_does_not_imply_independent
Answer: The intuition is like this: As $|Z|=|XY|=|X|$ you can predict the absolute value of $X$ from knowing $Z$ up to a sign. So $X$ and $Z$ cannot be independent. On the other hand, as $P(X=x) = P(X=-x)$ for all $x$, from knowing $Z$ you cannot tell whether $Y$ was positive or negative, i.e. both results are equally likely, i.e. $Z$ and $Y$ are independent.
As a proof you could show that

$P(|X|<1,|Z|>1) = 0 \neq P(|X|<1)P(|Z|>1)$ contradicting independence of $X,Z$.
Using your results on $P(Z<z)$ you can show that $$P(Y=1,Z<z)=\dots=P(Y=1)P(Z<z)$$ and $$P(Y=-1,Z<z)=\dots=P(Y=-1)P(Z<z)$$
showing that $Y,Z$ are independent.


Difference between manifest and observed variables

Question: I try to code SEM model using the semopy package (https://arxiv.org/pdf/1905.09376v1.pdf), but there are 3 types of variables there - except latent, there are mainifest and observed variables. What's the difference?
I have some features in my data and planned to match them to some latent variables, but how the model should look like in this 3-variable system? Should my features be observed variables with one to one relation with some randomly created manifest variable, which will be matched with latents? What's the point of it?
Answer: I agree that this is confusing.
Manifest variables and "observed" variables are both observed, in the sense that they are part of the input dataset, and not latent variables.
The distinction made in the semopy package is that manifest variables are part of the measurement model (ie the definition of the latent variables), whereas "observed" variables are part of the structural model (the relations between and among the latent variables and the "observed" variables)
From your description, you will define some latent variables as your measurement model, using the features as manifest variables. You won't have "observed" variables unless you have features that are part of the structural model.


cannot clear the cache in symfony2.1

Question: I have one rror when I clear the cache in my application,
and I think that is the cause of problem I encounter :

do you have any idea
thank you in advance
Answer: Does your app throw an error when you try to use the website? If not, try updating your vendors.
<code>php composer.phar self-update
php composer.phar update
</code>
Answer: It seems to be a privilege problem (acces refuse = denied access).
You should try to run the cmd window as an administrator (right click -> run as administrator) and run the command again and/or give a look at the privileges on the cache folder and give your current user read/write/execution.
Comment: I tried your suggestion but the same problem, but I don't know how to give a look at the the privileges on the cache and giving the user read/write/execution
Comment: it works now, I leat it manually, I deleted all contains of cache directory
Comment: Right click on the cache folder, choose properties. In the security tab you should have the list of users and permissions. If you want to keep it simple, give everyone (tout le monde in french) read/write/execute rights. This is not a recommended configuration in production.

cannot clear the cache in symfony2.1


How to change property 'string' in object with class Drupal\Core\StringTranslation\TranslatableMarkup in my hook?

Question: The property 'string' is protected as I can see here https://api.drupal.org/api/drupal/core!lib!Drupal!Core!StringTranslation!TranslatableMarkup.php/class/TranslatableMarkup/8.2.x
but I need to change word "- Any -" in my exposed filter form to my string "All terms"?
I cannot do this cause I do not know how to use this class and how to change output.
This hook says: cannot get value of protected property.
function MYtheme_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ( ( $form['#attributes']['class'][0] == 'views-exposed-form' ) &&
       ( $form['#info']['filter-field_color_target_id']['operator'] == 'field_color_target_id_op' ) )
  {
      dpm($form['color']['#options']['All']->string);
      //$form['color']['#options']['All']->string = t('All terms');
  }
}

Answer: The object TranslatableMarkup is the result of t(). It's not possible to modify the content of this object. You overwrite the object with a new instance:
form['color']['#options']['All'] = t('All terms');


Qual a melhor maneira de esconder funções JS visiveis ao especionar o HTML?

Question: Tenho algumas funções JavaScript nas minhas paginas que anteriormente eram inseridas direto no jsp, dentro das tags


Can a Man-in-the-Middle-Attack be achieved by adding a cloudfront domain to a domain not owned by me?

Question: Let's say I have a REST API running on ECS behind an Application Load Balancer(ALB) on AWS. The ALB is fronted by a cloudfront domain, called abcd.cloudfront.net. As one would expect, there's a CNAME record setup on the DNS provider called app.mysite.com pointing to the cloudfront domain with a valid SSL cert from ACM. The ALB has a rule to only allow requests that have the header HOST:app.mysite.com. This create a pretty standard API flow on AWS.
What would happen if someone, with no access to my AWS account, sets up a new cloudfront domain, abcd2.cloudfront.net with the domain app.fake-mysite.com and valid ACM cert *(for app.fake-mysite.com), and adds a behavior to point to app.mysite.com. Can this external entity use it's own ACM cert to cause a Man in the Middle Attack?
The request flow would look like this:
app.fake-mysite.com -> abcd2.cloudfront.net -> app.mysite.com -> abcd.cloudfront.net -> my-alb.domain -> 10.0.0.100:8080 (REST API)
Would it be possible for the external entity to intercept the request at the first hop and capture the encrypted data? If so, how can this be prevented?
*updated for clarity.
Comment: Better to be asked on [information security](https://security.stackexchange.com/)
Comment: How would they get a valid ACM cert?
Comment: The app.fake-mysite.com domain is owned by this external entity, so it should not be a problem to issue a valid ACM cert. I tried this "cloudfront hopping" with another domain that I own, and it seems to work.
Comment: it's not "man-in-the-middle" attack, as the certificate belongs to the fake app.. just using your services as a backend. if the user is using your app directly and the set if root certificates is not compromised, it's not mitm
Comment: Okay, so it's not a MITM in the scenario you're proposing, where the external entity is unable to override the cert on my domain. But my question is what happens if the user goes through the external entities' domain (app.fake-mysite.com)?
Comment: Question is not really about programming; Might be better suited for either networking (https://serverfault.com/) or info sec (https://security.stackexchange.com/)
Comment: @kelalaka that was a great suggestion! I followed up on information security stackexchange and got my answer.
Comment: @acorbel Please take a look at the comments under the accepted answer on security stackexchange, the custom headers can be bypassed.
Comment: Ah, this must be deleted, then!
Answer: "Would it be possible for the external entity to intercept the request at the first hop and capture the encrypted data?"
No, the external entity can not intercept as the browser will get a 301 Permanent Redirect.
Browser -> app.fake-mysite.com -> abcd2.cloudfront.net -> 301 to browser with redirect url as app.mysite.com

Browser -> app.mysite.com -> abcd.cloudfront.net -> my-alb.domain -> 10.0.0.100:8080 (REST API)

So, after the redirect the communication is directly between the browser and actual website.
Comment: Would it be a 301? As far as the REST API is concerned, the request would be coming from app.mysite.com. From what I understand, when adding custom origins to cloudfront distribution, cloudfront takes your origin request payload and makes a new request to the origin. Wouldn't that mean that the REST API would be unaware of the fact that the request originated at app.fake-mysite.com?
Comment: I have added screenshots for more clarity. It will be a 301 if you access  app.fake-mysite.com from browser. After 301, user's browser will then be talking to app.mysite.com and not fake.com. Check the network tab in screenshot2.
Comment: I have one request. Can you please setup a new domain name for your cloudfront distribution? This, along with a valid ACM cert will stop the 301 redirects. If you look at my original question, it includes app.fake-mysite.com. I did this experiment on some of my own domains, and adding the alternate CNAME stops the 301 redirects.
Comment: pls share your screenshot showing the network tab for the REST call... Even if you invoke REST call from app.fake on your API on backend, the response will not be readable on the browser due to CORS policies...
Comment: Unfortunately, I cannot expose the application where I did this test. I got an answer to this question on information security: https://security.stackexchange.com/a/249166/256945 . Thanks again for looking into it!
Comment: Just to clarify in a phishing attack a fake UI is provided but in your case your are redirecting to UI of genuine domain so browser will talk to genuine domain and phishing won't happen. Hypothetically, even if you consider that phishing happens then as well genuine domain will reject the request because genuine domain would have measures like captcha which will identify phishing requests and not give an access token if user is tricked to provide username and password. So, assuming a properly secure backend exists, creating such fake sites won't be able to break security.
Comment: But off-course if username and password is compromised then hacker can always break in unless you have MFA enabled.
Comment: I have to disagree about the redirect. Since the fake cloudfront dist makes a genuine request to the true (app.mysite.com) domain, there will be no redirects. The wrapper cloudfront dist along with a valid domain name acts a proxy to the real domain, so the backend is unaware of this wrapper existing. To the backend server, it will look like the request is coming from app.mysite.com, as the request does get routed through that domain. As mentioned in the comments on infromation security, a good check is using javascript to ensure the `location.href` is pointing to the correct domain.
Answer: This question has been answered over at information security. The answer is that this a valid phishing attack.
Link to accepted answer:
https://security.stackexchange.com/a/249166/256945


Electric guitar nut sticking

Question: Update
I had a bone nut put on by a respected local luthier. That nut is the slipperiest thing since... since slippers, so slippery it's hard to get graphite on it because the pencil slips. Still the same problem.
I don't think it's the nut. I think it's a balky tension roller, at a bad angle, on the Bigsby (B5):

Even with a Vibramate, my angle from roller to bridge saddles is steep. I'll try string-over-roller and see what I get.
But when I lower the pitch with the Bigsby and release, after I release the strings go flat. If the string is hung up in the nut and won't come back, I would expect it to go sharp when full tension comes back on. But if it's hanging up at the tension roller, I would expect it to stay flat.
The replacement tension roller he's got is out of stock at the moment, but an email elicited a prompt reply that they'll be back in a month or so.
Since the Bigsby hasn't always behaved quite so badly, I wonder if it didn't just happen to get rotated to a spot where it hangs up more. The best hope may be polishing and lubrication (UPDATE: Polished bearing surfaces with jeweler's rouge, hosed down with silicone lube, little or no improvement).
Or a Jazzmaster.

Is it possible to do something to the nut of an electric guitar so that the strings begin to stick when they never stuck before?
I recently took a Gibson SG to an extremely reputable local independent shop for a set up. They did a good job, except the strings have been sticking in the nut since I got it back. I've owned the guitar for 11 years and it never had this problem.
I added a Bigsby to it a few weeks before the setup, and had no trouble. I was using the Bigsby regularly in three or four hour rehearsals and just checking the tuning every couple songs. When I got it back it literally could not be tuned. I carefully cleaned the nut, polished the slots with jeweler's rouge, cleaned the slots again, put in a little graphite, replaced the strings, and now it's basically playable until put anything more than very delicate, gentle pressure on the Bigsby. Then wham, it's flat. The Bigsby is no longer usable.
I've been using the same brand and guage of strings with the guitar since I bought it. After I got it back, I replaced them out of a box of ten sets that I bought a couple of years ago.
When I called, the guy I talked to told me it wasn't happening, and if it was, it wasn't their fault, but I should put some 3-in-1 oil in the slots anyway. If it kept happening, even though it wasn't happening, I could take it in and they'd file the nut slots. I asked how the nut slots were too tight now when they were OK a week earlier, and he didn't have an answer to that one.
I didn't get sarcastic on the phone because you can't do that, and besides, it's a small city and they're the local independent shop. I don't want to be That Guy. I'm not taking it back to that shop because I've been on both ends of interactions with unhappy customers, and I've had painful experience with the kind of people who automatically assume that the customer is delusional. That's not the guy you want sawing on your guitar with a file because that's the first theory that popped into his head.
But am I delusional? They think I'm delusional, and I'd like to think that this is a curable delusion. But I'm not deaf. This guitar has a problem now and it didn't before. I took it home, sat down to play it, and it was untunable.
Could it be the changing temperature and humidity this time of year?
I figure I'll just find a local luthier who does repair work and get a Delrin or bone nut put on. But I'm a little jumpy now about letting strangers touch it.
Comment: A reputable technician would NEVER tell you to put 3-in-1 oil in nut slots. Check the slots and see if they are rounded, or V shaped. It is possible that the hack retouched your slots with a triangle file instead of a nut file. V cut slots will cause sticking.
Comment: Hmmm. Is the string spacing in the roller bridge the same exact spacing as the old bridge?
Comment: Why did you bring it in? Was the neck possibly backbowed causing the strings to fret out? The fix for that may have contributed to what you are experiencing.
Comment: @user6591 The neck was ok. I had put a roller bridge on it, and took the pickups out to cut the scratch plate for a Vibramate for the Bigsby. Also the pole pieces were all over. So everything was adjusted to my DIY guesswork and I wanted it done right by a competent pro. Still do, in fact; the A and D strings buzz a bit with a capo in the third fret now. But overall it's better than it was. Except the nut.
Comment: @user6591 The neck was ok. I had put a roller bridge on it, and took the pickups out to cut the scratch plate for a Vibramate for the Bigsby. Also the pole pieces were all over. So everything was adjusted to my DIY guesswork and I wanted it done right by a competent pro. Still do, in fact; the A and D strings buzz a bit with a capo in the third fret now. But overall it's better than it was. Except the nut.
Comment: @user6591 Pretty close. The strings were centered on the pole pieces and they are still. Not enough to make a difference in a triangle 24 3/4" long.
Answer: Tremolos can cause tuning and intonation issues all on their own, and I suspect that the tremolo combined with something that happened during the setup is the cause. Is it possible that the shop replaced the nut, or changed the string gauge? Either of those things might be related to a tuning problem. Since you're specifically asking about the nut, I'm not going to address tremolo issues specifically, but I highly recommend looking into those as well.
Can the nut affect tuning stability?
Yes it's possible that the nut binding to the strings can affect tuning stability, and it can't hurt to eliminate it as a cause before moving on to the tremolo.
The nut slots need to be wide enough to allow the strings to move freely. I know of three possible causes:

The nut is dirtyif this is the case, cleaning the nut can help. Putting oil in the nut slots may or may not help, but filing the nut slots to be wider is the best solution. You really need a set of nut files to do this properly, but I've done it with very thin, fine sandpaper. You just want to be careful not to deepen the nut slot.
The nut has been changedWhether the nut was modified by the shop or replaced with another, this could affect the tuning stability. If this is the case replacing the nut with a properly cut/sized one should help. You can also look into raising the action a touch to handle the buzzing when using a capo around the 3rd fret.
String gauge has been increasedThis could cause binding in the nut slots. You could try changing to a lighter string gauge, but keep in mind this can affect action and intonation.

If none of these solve the problem, I'd move along to the tuning machines:

Were the strings wrapped around the tuning posts?The question Acoustic guitar - how to wind strings on the tuning posts has a lot of good information about how to do this. Maybe the shop installed the strings differently than you have done for years.
Have the strings had time to stretch out?Give them some time, maybe settling in will help.

If none of this helps I suggest looking into the Bigsby trem more closely.
Comment: The strings all stick now. The strings were wound around the posts differently than I do it, but when I cleaned out the slots on getting the guitar back I restrung it my way, with the same strings I've been using for years -- from the same value pack of 10 sets, in fact, so they were even the same lot number as the strings that were on it before I took it in (I gave them another set from that box to restring, but a mixup could happen of course. I stretched them by hand until they were stable, and they've had a week and a half to settle in. I can't swear it's the same nut as before, though.
Comment: I think it's almost certainly the tremolo, then. Why the problem would crop up only after a setup I don't know. I'm not familiar with Bigsby systems at all, gonna throw these out there: Is it possible the shop  changed a setting on the trem while doing the setup? Or are there trem issues that can show up on after time? Is it possible that your ears improved?

Electric guitar nut sticking


The best way to deal with relations

Question: I am trying to learn views/panels and therefore am working on cinema listings: there are 2 cities, each has 2 cinemas, each cinema has 2 show halls and there is a list of 10 movies, that are shown in some of these halls during the period of 5 days.
The question is - what would be the easiest way to enter and display such listings - should I use panels pages, panel nodes and is it possible to create such things using node references and relations?
please correct me if I'm wrong - i'm a newbie here:
I was thinking to create 10 nodes for each movie, where there is description of the movie, picture, etc, but then I am lost - shoud I create a node for each cinema and so on, or is it better to use taxonomy terms and to add  these to each movie: city, cinema, hall and show time - I'm lost here... :(
the result that i want to achieve is that I'm clicking on a movie and I'm getting description and all it's showtimes. And if I'm clicking on particular cinema - I'm getting a timetable with movie names and times.
Answer: You need to get the data structure right, then everything will fall in place using Views.
Apart from city, cinema and movie content types, I'd suggest creating a session content type, too, which would link a movie with cinema, adding the time and hall number information. To maintain relationships between individual chunks of data, you want to use the CCK's node reference module (it is part of D7).
Roughly, you'd go with content types like so:
<code>city (name)
cinema (name, city_ref, hall_count)
movie (name, description, picture, rating)
session (movie_ref, cinema_ref, hall_number, date_time)
</code>
It always depends on your requirements, but in this particular case I'd recommend using a separate content type for cinemas instead of taxonomy. Each cinema's node would serve information about the cinema, number of halls, and it would also reference the city it's located in and would be referenced by the screening nodes.
On the other hand if you have no other information about a city other than it's name, it should be safe to set it up as taxonomy.
To make it all work together, i.e. display listing pages, or allow users to search for movies and session times, you'll have to pick up the Views module.
Implementation of a "movie description and all it's showtimes" page would be the movie node page with a view attached (via Views Attach for D6 or EVA for D7) that would list show times for the movie passed as node ID from URL.
For the "cinema timetable with movie names and times", you'd do the same thing, but since you're displaying information about multiple movies, you would also use Views relationship (session -> movie_ref) to fetch in the movie nodes to be able to use their names as a views field.
Comment: Thank you! Will have to study Views though - it seems quite a challenge for me at this moment :( But also I have additional question - is it possible to enter the sessions at the same time (in the same content creation form) when creating a movie? It would be great if I could enter movie description AND it's shows in one form. I do believe that it would be the same views joining two different content types again, or am I wrong? Could anyone explain me a bit more about these things?
Comment: could you please explain a little bit on how to add hall_count - I would like to enter the exact amount of halls in particular cinema to be able to chose from that number the exact one. Is it possible?

The best way to deal with relations


Measure space $(\Omega ,\mathcal F)$ and $\mathbb P:\mathcal F\to [0,1]$ that is finite additive but not $\sigma -$additive

Question: I'm looking for a space $(\Omega ,\mathcal F)$ and a function $\mathbb P:\mathcal F\to [0,1]$ s.t. $\mathbb P(\Omega )=1$ and $\mathbb P$ is addtitive but not $\sigma -$additive.
Of course I got inspired but several post on mathstack exchange by $\Omega =\mathbb R$, $$\mathcal F=\{A\subset \mathbb R\mid A\text{ or $A^c$ is countable}\},$$
and $\mathbb P(A)=0$ if $A$ is countable an $\mathbb P(A)=1$ if $A$ is not countable. But unfortunately this is a probability measure. Any example ?

My question is not a duplicate of this post (as several thought) because the answers don't provide probability spaces.
Comment: To people voting to close: This is still not a duplicate of the linked post since that doesn't ask for an example with total measure $1$ and doesn't get one. All $3$ answers rely very much on having sets of infinite measure.
Comment: @Mark: If you read careful both answer, they don't provide a counter example. For example, in saz answer, $\mu$ is not defined on $2\mathbb N\in \mathcal P(\mathbb N)$. For the other answer, it's not a probability space.
Comment: @saulspatz: Same remark than for mark (it's the same link)
Comment: @John The site puts up this message when one votes to close a duplicate.  Mark made the comment, but didn't vote to close.
Comment: What is your definition of a premeasure? The definition on the wikipedia page [here](https://en.wikipedia.org/wiki/Pre-measure) would trivially imply that any premeasure defined on a $\sigma$-algebra is a measure so you must mean something other than this.
Comment: @RhysSteele: I don't know why I wrote premeasure... What I wanted to say by premeasure is that $\mathbb P$ is additive but not $\sigma -$finite (I really don't know that premeasure was a real term, sorry for the mistakes).
Answer: This answer will show only that such a set function must exist. The reason that it is difficult to write one down explicitly is that the existence of an example on $\mathbb{N}$ requires something more than ZF. I suspect that the existence of any example will require more than just ZF but I am not sure of this. I will use the ultrafilter lemma$^*$.
Let $\Omega = \mathbb{N}$ and let $\mathcal{F} = \mathcal{P}(\Omega)$. Let $\mathcal{G}$ be a non-principal ultrafilter on $\mathbb{N}$ (recall that an ultrafilter on $\mathbb{N}$ is called principal if it is of the form $\mathcal{G} = \{A \subseteq \mathbb{N} : a \in A\}$ for some fixed $a$).
Define
$$\mathbb{P}(A) = \begin{cases} 1 \qquad A \in \mathcal{G} \\ 0 \qquad \text{otherwise} \end{cases}$$
Then $\mathbb{P}$ is a finitely additive set function (see this question). However since $\mathcal{G}$ is non-principal, it cannot contain any finite set. In particular, $\mathbb{P}(\{i\}) = 0$ for every $i \in \mathbb{N}$. Hence $\mathbb{P}$ is not countably additive since
$$1 = \mathbb{P}(\mathbb{N}) \neq \sum_{i=0}^\infty \mathbb{P}(\{i\}) = 0$$

$^*$ which is equivalent to the Boolean Prime ideal theorem and hence strictly weaker than choice. I need the ultrafilter lemma to see that a non-principal ultrafilter exists on $\mathbb{N}$. One way to get this is to use the ultrafilter lemma to get an ultrafilter extending the cofinite filter. This ultrafilter then cannot be principal.
As pointed out in the answer here and the references therein, it is consistent with ZF+DC that there are no "non-principal measures" on $\mathbb{N}$. A non-principal measure on the powerset of a set $X$ is a set function $\mu: \mathcal{P}(X) \to [0,1]$ such that $\mu$ is finitely additive, $\mu(X) = 1$ and $\mu(\{x\}) = 0$ for all $x$. The $\mathbb{P}$ in this answer is exactly an example of a non-principal measure on $\mathbb{N}$. The answer to my follow up question here then shows that it is consistent with ZF+DC that you cannot construct an example on $\mathbb{N}$.
Comment: @CalvinKhor I think the problem with that is that the limit doesn't exist for all subsets of $\mathbb{N}$ so $m$ isn't actually defined on $\mathcal{P}(\mathbb{N})$. In fact, the subset of $\mathcal{P}(\mathbb{N})$ for which the limit exists isn't a $\sigma$-algebra. DC is dependent choice. I'm not a set theorist either, so I don't want to pretend I have a detailed idea of what's going on. The last part of my answer is just put together from reference hunting.
Comment: I was under the impression that the asymptotic density $m: \mathcal P(\mathbb N) \to\mathbb [0,1]$ defined by
$$m(A) = \lim_{n\to\infty} \frac{1}{n} | A \cap \{ 1,\dots, n\}|$$
was an example of a non-principal finitely additive measure with 'mass' 1. Am I wrong, or where is the DC here?(I assume DC is some kind of Choice? not a set theorist, sorry)
Comment: oh, of course! thanks


Use cropped image with fallback in TypoScript in TYPO3 8

Question: This TS code always produces a 600x400px image:
  10 = FILES
  10 {
      required = 1
      references {
        table = tt_content
        fieldName = image
      }
      renderObj = IMAGE
      renderObj {
        wrap =
|

        file.import.data = file:current:originalUid // file:current:uid
        file.crop.data = file:current:crop
        file.width=600c
        file.height=400c
      }
  }

If I remove
      file.width=600c
      file.height=400c

then the cropped image from the crop wizard will be used.
But I need both (it's an upgrade of an existing site): if available, the cropped image is used, but if not, the given height and width are used.
How do I use the "file:current:crop" part to override width & height only if given? Or how do I set a fallback? something like...
file.crop.data = file:current:crop // fallback...

Answer: I've moved to FLUIDTEMPLATE in the renderObj:
renderObj = FLUIDTEMPLATE
renderObj {
  file = path/to/templates/content/teaser.html
  dataProcessing {
    10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
    10 {
      references.fieldName = image
      references.table = tt_content
      as = teaserimages
    }
  }
}

(The FilesProcessor is required)
And then in the template
<img src="<f:uri.image image="{teaserimages.0}" width="600c" height="400c" />

Behaves as expected


What does a high number of rx_crc_errors indicate?

Question: When running ethtool I notice a very high level of rx_crc_errors. When the server is under heavy load the counter goes even higher. What does this typically point to as the source of the problem? Media or cable issues?
Answer: Typically errors of this type (errors that indicate bad data integrity) are the result of layer 1 problems. I'd investigate cabling and the physical layer interface first.
Comment: Thanks for the information. I'll try doing the testing you've suggested.
Answer: Replacing the ethernet cable would be my first step to debug, followed by testing the patch field connectors etc.
Comment: Thanks for the information. I'll try doing the testing you've suggested.


Installing Python 2.7 broke "yum"

Question: I installed Python 2.7 and pointed /usr/bin/python to /usr/local/bin/python2.7
After installing Python 2.7, I get the following error message every time I use yum
> sudo yum install setuptools
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.2 (default, Dec 25 2011, 19:13:04)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq

How do I get yum working with Python 2.7 on CentOS?
Answer: You can edit the yum (/usr/bin/yum) call to python like:
#!/usr/bin/python2.4
Make a backup first ;-)
Answer: Quite simply - don't point /usr/bin/python to any other python. Instead, if you want to use python2.7 just modify your path to put /usr/local/bin first.
In general, you shouldn't touch anything in /usr/{bin,lib...} other than in /usr/local
Answer: this why you made installation to a new version of python than the one that was already installed with your OS and that yum is dependent on.
simply you have to edit usr/bin/yum and change the shebang to the same version installed within your distribution.
change
#!/usr/bin/python

to specific version
#!/usr/bin/python2.6 (in my os)

Answer: You don't get yum working with Python 2.7.  Instead, you need to have to have 2.7 installed too, but leave 2.4 where it is to avoid breaking e.g. yum.
Alfred Chiesa wrote a guide walking through this process. Check it out and see if that can help you accomplish what you need.
Answer: You can build python2.7 (as described in http://docs.python.org/devguide/setup.html#unix ) instead of using yum to install it. This involves downloading the source and following the directions found in the README. When you get to the point where you would normally run 'make install', you want to run 'make altinstall'. This will leave default python in place and give a python2.7 command in /usr/local/bin/ instead.
From the Python 2.7 README: "On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument to the configure
script) you must take care that your primary python executable is not
overwritten by the installation of a different version.  All files and
directories installed using "make altinstall" contain the major and minor
version and can thus live side-by-side.  "make install" also creates
${prefix}/bin/python which refers to ${prefix}/bin/pythonX.Y.  If you intend
to install multiple versions using the same prefix you must decide which
version (if any) is your "primary" version.  Install that version using
"make install".  Install all other versions using "make altinstall".
For example, if you want to install Python 2.5, 2.6 and 3.0 with 2.6 being
the primary version, you would execute "make install" in your 2.6 build
directory and "make altinstall" in the others."

Installing Python 2.7 broke "yum"


Como trabalhar com UpdateView e Forms no template

Question: Estou tentando renderizar os dados de um cliente no template, porém o gostaria de fazer sem utilizar {{ form.as_p }} ou {{ form.as_table }} whatever,gostaria de saber se tem alguma maneria de se utilizar o id dos clientes em questão e utilizar inputs no template no lugar de "form", já tentei de tudo aqui, sei que se entrar no shell do django consigo pegar o id apenas do form, porém mesmo com o id em mãos não consigo fazer com que o cliente seja renderizado para edição, os campos aparecem porém em branco.
Detalhe: Com CreateView este método de pegar os ids do form funcionou, porém quero que o mesmo aconteça com UpdateView.
Desde já agradeço a atenção.
Comment: Pq vc n quer usar o {{ form.as_p }}?  Existe alguma informação que vc não deseja mostrar?
Comment: Então Nathan, o que acontece de verdade e o seguinte, quero trabalhar com o layout do mesmo porém não estou conseguindo com form.as_p, estou utilizando bootstrap em todo o projeto porém estou parado ate hoje na parte do layout, como trabalhar com css em cima do form.as_p? estou com uma combobox também no mesmo, e não consegui um resultado favorável ao tentar implementar o css na mesma.
Comment: Bem, então o problema é a "apresentação" dos dados para o usuário? Se sim vc pode criar sua própria Form do Model, ao invés de apenas estender de forms.ModelForm vc pode dizer como cada tipo de dado deve ser mostrado e se deve ser ocultado.
Answer: Se você quer apenas exibir os dados de um cliente em um template, você pode utilizar o DetailView
https://docs.djangoproject.com/en/1.9/ref/class-based-views/generic-display/#detailview
class ClienteDetailView(DetailView):
    model = Cliente
    template_name = 'clientes/detail.html'

O problema de exibir os campos em branco, talvez seja porque na sua url você colocou algum outro parâmetro para o id, e não pk.
#urls.py
url(r'^(?P<pk>\d+)/editar/$', ClienteUpdateView.as_view(), name='cliente_update'),

#views
class ClienteUpdateView(UpdateView):
    model = Cliente
    form_class = ClienteForm
    template_name = 'clientes/update.html'

#listagem de clientes
...
   Editar
...

https://docs.djangoproject.com/en/1.9/ref/class-based-views/generic-editing/#updateview


Properly set up exponential decay of learning rate in tensorflow

Question: I need to apply an exponential decay of learning rate every 10 epochs. Initial learning rate is 0.000001, and decay factor is 0.95
is this the proper way to set it up?
lr_schedule = tf.keras.optimizers.schedules.ExponentialDecay(
        initial_learning_rate=0.000001,
        decay_steps=(my_steps_per_epoch*10),
        decay_rate=0.05)
opt = tf.keras.optimizers.SGD(learning_rate=lr_schedule, momentum=0.9)

The formula of exponential decay is current_lr = initial_lr * (1 - decay_factor)^t
Except that in the code it is implemented as :
decayed_learning_rate = learning_rate *
                      decay_rate ^ (global_step / decay_steps)

To my knowledge, decay_rate should be 1 - decay_factor and decay_steps should mean how many steps are performed before applying the decay, in my case my_steps_per_epoch*10. Is that correct?
EDIT:
If I pause and save my model (using callbacks) after the 10th epoch, and then resume by loading the model and calling model.fit with initial_epoch=10 and epochs=11, will it start in the 11th epoch and apply the exponential decay?
Answer: decay_steps can be used to state after how many steps (processed batches) you will decay the learning rate. I find it quite useful to just specify the initial and the final learning rate and calculate the decay_factor automatically via the following:
initial_learning_rate = 0.1
final_learning_rate = 0.0001
learning_rate_decay_factor = (final_learning_rate / initial_learning_rate)**(1/epochs)
steps_per_epoch = int(train_size/batch_size)

lr_schedule = tf.keras.optimizers.schedules.ExponentialDecay(
                initial_learning_rate=initial_learning_rate,
                decay_steps=steps_per_epoch,
                decay_rate=learning_rate_decay_factor,
                staircase=True)


Can I use cloud function in storage rule?

Question: Since there is no way to find size of a folder directly in rule, I have made a function which will determine the size of a file(in folder xxx) add that size to a child(xxx) in realtime database. Using this value, I can block user from adding data inside child (xxx) in realtime database. Since it is not possible to use to realtime database directly in storage rule. Can I call a function from storage rule which will check the child(xxx) in realtime database and return true or false based on the value
Answer: Security rules run in full isolation. There currently is no way to access other Firebase services from within the security rules of Cloud Storage.
It is a valid and common request though, so I recommend filing a feature request.


Finger dexterity issues

Question: I have some weird issues with my left fret playing hand. I'm a brand new guitar player and the way my fingers automatically react when spreading, especially when trying to spread them in a claw, is making playing the guitar bloody difficult. That pinky has a mind of its own.
My fingers can go where I want them to, if I move them with my other hand, but they naturally bend inwards particular the pinky and whatever the other fingers called (what is that second middle finger commonly referred to?)
Anyway, anyone got any exercises I can do to loosen them up a bit? It feels like ligaments or muscles forcing them inwards and it's a pain trying/almost impossible to spread the fingers properly. My right hand is fine but I'm right handed so it feels weird.
Comment: I don't think there's anything unusual there; it looks a lot like my left hand. Here's a good stretching exercise: https://www.youtube.com/watch?v=UBGObFm_Gfo&t=5m18s
Answer: Loosening them up isn't the issue.  You are "brand new to guitar".  I hate to break the news to you, if you wanted to be shredding by the end of the week, but it takes years to get proper hand posture in the muscle memory.
First off there is a natural curvature to the grip and that will not go away.  How much of an issue this is depends on what you are trying to play, some guitarists play on the pad more than the tip and if you do that the bend of the fingers will not be as severe.  Classical guitarists play more on the tip.
Ideally, as a beginner, you should be able to keep each of the 4 fingers over 4 consecutive frets on one string and play a chromatic sequence (1, 2, 3, 4) and (4, 3, 2, 1).  You should also be able to pin the string down right behind the fret (not just anywhere within the space between the frets).  Clearly this may require a bit of a shift as the middle and ring fingers tend to want to stay together.
Stretching is not the answer, focused practice on simple exercises like the 1-2-3-4 on all strings in different positions is the key.  If you search you will find some place on the neck where you can do this fairly easily without a lot of stretching or other contortions.  Practice there until it's comfortable and effortless, then start moving further back toward the nut and up towards the bridge.
Some of my students (with hands that look like yours) find it easy to do this exercise on the top 4 strings (D, G, B, e) up at the 7th fret but can't seem to get the A or E strings.  After a couple weeks of practicing on the top strings the A and E worked no effort (it a form of tricking your body to accept what is difficult as being a small perturbation to something easy).  Sometimes we focus more on the hardest thing and get nothing done.  You want to train your fingers to be comfortable in proper position.  They should float over the fret spaces even when one finger goes down to fret a note (many people cramp their hand together a lose form).
If you work at maintaining proper posture and nailing the correct note your hand will adjust.  It is natural for the index and pinky fingers to hit the string slightly on outside rather than directly under the finger nail like the middle 2 fingers, so don't worry if you cannot get that to happen.  Everyone has slight deviations in physiology and needs to adjust expectations, but forcing your body to do something contorted will not make your form better.

Finger dexterity issues


How can I draw a perpendicular plane to a plane in Geogebra?

Question: I want to find a plane that goes through the origin and intersects perpendicularily the plane $2x+3y+z=12$.
I have done the following:
The equation of the plane is $Ax+By+Cz=D$.
Since it goes through the origin, we get that $D=0$.
The plane is perpendicular to $2x+3y+z=12$. Therefore their normal vectors are perpendicular, i.e. their dot product has to be equal to $0$.
\begin{equation*}(A,B,C)\cdot (2,3,1)=0 \Rightarrow 2A+3B+C=0 \Rightarrow C=-2A-3B\end{equation*}
So a desired plane is of the form \begin{equation*}Ax+By+(-2A-3B)z=0\end{equation*} Is that correct? Or can we calculate more coefficients?
Then I want to draw the two planes in geogebra. How can I draw the plane where we don't know all the coefficients?
Comment: There is an infinite number of such planes.
Comment: So to draw this in geogebra do we take specific values for $A$ and $B$ ? @amd
Comment: I might pick a specific perpendicular plane—use some specific values for $A$ and $B$—and then add a parameterized rotation about the original plane's normal to be able to view all of the perpendicular planes.
Comment: https://www.geogebra.org/3d?lang=en Here you can draw 3d planes and objects .
I think that CalcPlot3D is better at 3d:
https://www.monroecc.edu/faculty/paulseeburger/calcnsf/CalcPlot3D/
Comment: So to draw this in geogebra do we take specific values for $A$ and $B$ ?
Answer: First of all draw with GeoGebra the given plane $\alpha$, by writing its equation $2x+3y+z=12$ into the input bar.
Select then the tool "Perpendicular line" and use it to draw the line $r$ passing through the origin and perpendicular to plane $\alpha$. Create then any other point $P$ in space not on line $r$ (for instance on plane $\alpha$) and finally draw the plane passing through line $r$ and point $P$: that plane is by definition perpendicular to $\alpha$.


What are the rules of scope?

Question: What are the rules for scope in standard mathematics? I've mostly been working with informal/standard mathematics so the concepts of 'scope' are not familliar to me.
I understand that a variable can be defined in a specific context and scope, discussing when something is the 'same variable' perhaps is dependent on the scope, so let's say the symbol 'x' is the 'same variable' within the context of the scope. The definition of when something is 'the same variable' or 'in scope' is difficult. Is there a precise definition of this?
These are the rules I seem to understsand so far:

A bound variable is in scope if it comes after a quantifier or bounding operator only in the expression after that operator

A variable which is introduced using free occurences is in-scope in the same formula/expression, as long as it is free in the formula.

Are there any other rules that must be known? For example, if I am doing something and I introduce several formulas with free occurences of a symbol 'x' is the scope limited to each formula or is 'x' the same variable in each formula as they are part of the same 'scope'.When given two formulas with occurences of 'x', for each assignment, 'x' is in scope in both formulas if both yield a truth value?
Is it formally correct to introduce the same symbol in a formula twice (through binding) but in different scopes?
Can I use the same symbol for both free and bound variables in the same language?
Comment: see [Scope (logic)](https://en.wikipedia.org/wiki/Scope_(logic)): it is the formula following the quantifier, usually enclosed in parentheses. If parentheses is omitted, the quantifier applies as little as possible. Example: $\forall x Px \to Qx$ vs $\forall x (Px \to Qx)$
Comment: If we have 'free' variables does scope 'apply'? If I decide one variable takes values in the domain of reals and another in naturals but use the same symbol '$x$' I would say there is different scope, or just a differrent context? Can I use the same symbol as free and bound in the same language?
Comment: No, free variables have occurrences in formulas: var $x$ occurs one in $Px$ and twice in $x=x$.
Comment: "scope" means: the extent of the area or subject matter that something deals with or to which it is relevant. Thus, a quantifier has a *scope* because it performs an action (bind variables) in a certain formula; the scope is the part of the formula on which quantifier applies.
Comment: Can I use the same symbol as free and bound in the same language? Yes, also if there are treatments of predicate logic (see Gentzen and [Smullyan](https://books.google.ba/books?id=kgvhQ-oSZiUC)) where $x,y$ are used ONLY bound and $a,b$ are used free.
Comment: Your question about variable scope between formulas within a text is far more interesting than within a single formula. I imagine the situation is similar to pronouns in natural language: the reader may have to work things out based on what makes the most sense, although there are some patterns. See https://en.wikipedia.org/wiki/Binding_(linguistics)
Answer: I'm not aware that anyone has written down formal rules, but as a matter of convention, it's confusing for readers to use the same variable names for both a free and a bound variable so I would avoid it. The most forgivable kinds of recycling are dummy variables such as the indices of summations, e.g. in expressions like
$$a_n = \sum_{k=0}^n b_k$$
the dummy / bound variable $k$ indexing the summation is tacitly understood to have local scope confined to the summation and nobody will be confused if you use the same index for a different summation, and similarly for dummy integration variables such as the variable $t$ in an expression like
$$g(x) = \int_0^x f(t) \, dt.$$
Other than that I would generally avoid recycling variable names but there are a few forgivable exceptions that you pick up from reading other people's mathematical writing, e.g. nobody will be confused if you write $f(x), g(x), h(x)$ with the tacit understanding that $f, g, h$ are three functions and $x$ is just a dummy variable describing some element of their domain, whatever that is. But if, for example, there is a quantity $n$ that you need to keep track of in the course of the argument, definitely do not reuse that symbol to refer to anything else in the argument, even dummy variables.
As you read mathematical writing you'll also pick up conventions for which symbols tend to be "reserved" for which purposes, e.g. it is common to reserve $i, j, k$ as dummy variables to index summations (although $i$ should be avoided if you need to write down complex numbers), and using these conventions improves readability so it's a good idea not to deviate from them too much.
Just try to write things that aren't confusing to read. You're trying to communicate something to another human, not a compiler. So ultimately the guiding question is: could a typical reader be confused by this notational choice, or not?
Comment: you mean "$x$ ist just a dummy variable describing some element of their *domain*" …
Comment: Yes, thank you.

What are the rules of scope?


'p-value' for clustering

Question: I was just wondering if there is a way to check if the clustering found by a specific method (e.g., KMeans, DBSCAN, Mixture Models, ...) is significant. Something in line with, there is 5% chance that the clustering found by the algorithm isn't random.
I am struggling to find the correct method for this. Bootstrapping or permutation testing is not an option, since there is no true label.
Comment: This would first require a precise definition of a cluster, which may be quite hard for some problems.
Comment: >Something in line with, there is 5% change that the clustering found by the algorithm isn't random. - this is a common misconception about p-values, they do not guarantee that. I'd recommend you to start with Gaussian Mixture Models and BIC/AIC to address your initial question (even if it is not about pvalues)
Comment: What do you mean by "there is no true label"? Don't you believe that there is such a thing as a true model (then p-values don't make sense) or are you saying that the problem is that you don't observe the true label?
Comment: I have a paper where we suggest a p-value for a clustering (https://arxiv.org/abs/1801.00332). The method is very model specific though (clustering in panels).
Comment: @AndreasDzemski , what I tried to say is that I don't observe the true label. I am not sure if there is a true model. I am trying to express whether the clustering found by the algorithm is not just random noise.
Comment: @GermanDemidov , let's say I did use Gaussian Mixture models, and used BIC/AIC for the number of clusters for the model. If the optimal number of clusters according to BIC/AIC is 2, and the values for BIC/AIC are only increasing with the number of clusters. Is that sufficient to conclude there is no valid clustering?
Comment: You have to find a way to make "not just random noise" operational. For example, in a Gaussian mixture you can try to test against the model where there is only one group (so no mixture). You don't need "true" labels. Under your null hypothesis everyone has the same label.
Comment: @Th. why, the number of clusters is equal to 2, it seems that there are 2 clusters =) if the preferable model by BIC/AIC (they are different and different considerations are inside, there is a good thread on stats.stackexchange about that!) has only 1 cluster - then yes, I'd say you can be more or less sure that there no "valid" clustering. But - there is a lot of but.
Answer: There is the variance ratio criterion, closely related to the F-test.
But if you interpret it as f-test you get absurd high p-values because the test data not being independent to how the data was generated.
You could literally optimize the model to maximize the p-value, and the results will be meaningless, pure overfitting to this one number.
If you want to test your model, it will need to be on fresh data.
A different strategy is used by the gap statistic. IIRC they generate random data assuming a uniform distribution. If you do this 100 times and that data always clusters worse, then you can at least argue that your input data is not uniform... (It could be a diagonal line, or a Gaussian though, neither of which are good clusters...).
Comment: +1 for gap statistic -- can't get a much more "null" distribution than uniform.

'p-value' for clustering


How to add diffent makers on the image

Question: How to add a marker in different part of the image (please look at the attached photo),

There is a module Imagefield marker which is not working. is there any other similar module?
Thank for the help.
Comment: https://www.drupal.org/project/image_annotator
Comment: https://www.drupal.org/project/image_hotspots
Answer: ImageCache Actions is the right module which you're looking for. Enable Imagecache Actions and Image Effects Text module
Go and edit the image style at admin/config/media/image-styles and select effect Text.

How to add diffent makers on the image


Is there a way to dynamically allocate or assign values to ivars of a class at runtime in Cocoa / Cocoa Touch?

Question: I'm sure we can dynamically determine iVars of a class at run time. Is there any way to allocate the determined iVars during run time?
TIA..
Answer: The short answer and the one you probably want is: [obj setValue:@"woof" forKey:@"dog"];
and for ramblings...
you can using the runtime find all of the iVars of a class with:
Ivar * class_copyIvarList(Class cls, unsigned int *outCount)
eg:
id someObj; //assigned elsewhere
unsigned int count = 0;
Ivar * iVarList = class_copyIvarList([someObj class],&count);
for(;count>0;count--)
{
    Ivar testVar = iVarList[count];
    //do something with test Ivar
}
free(iVarList);

I am almost sure that you wouldn't ever want to do that except perhaps in a debugging scenario... introspecting the private frameworks etc.
or if you know the name of the iVar you can use:
 Ivar object_setInstanceVariable(id obj, const char *name, void *value) or the more objc way of [obj setValue: @"woof" forKey:@"dog"] which will eventually fail through to setting the iVar.
what you could potentially do, and I have had to do in the past is to introspect the properties list:
with an analogous call to: objc_property_t * class_copyPropertyList(Class cls, unsigned int *outCount) this can be useful for copying unknown objects, and for debugging.


Is it possible for two drupal views to share the same pager limit

Question: I have two separate views 'now' and 'next', they both collectively must only have three items. Is there a way for them to share the same pager limit for example if the 'now' view has one item the 'next' view can only display two items as the pager limit is three.
Comment: How do you display them? Page and block? Attachments? Two blocks?..
Comment: They are displayed in two separate blocks
Comment: So the answer is probably *no* - there is no logical connection between them. Of course there usually is a way to hack around limits like this, but it may be a bit complicated to implement it.
Comment: I posted this question on stack-overflow and got a response saying it could be done by 'Then you can alter the second view and put limit and offset by checking the url and getting the page number of the 'now' view.
Comment: Do you have any idea how to do that /
Comment: A bit - but with blocks it's tricky to know which one will be actually rendered first. So it's a nice bit of coding and quite a lot of testing and I will not do that for you. See [`views_get_view()`](https://api.drupal.org/api/views/views.module/function/views_get_view/7) - good entry point for interacting with views programatically.
Answer: If you want to create the blocks yourself, eg, not just via the Block UI and Views, you can hack it together with using various hooks available within Views.
First out the door, I could see using Views' standard block for the now View, but in the next block,  using views_get_view_result() to look at the results of the now View and depending upon its result, eg, how many results there are, changing the pager of the next View to be whatever you want, in this case 1 or 2.
Note that this of course entails running the now View queries twice, so you could create custom blocks containing both Views and statically save the information to be shared across the Page but that introduces other ugliness.
And then if any of these Views are cached, another set of issues crops up.
So, as @molot has mentioned in comments, there is a bunch to think about here.