How to write a minimalistic Java Client for OpenMQ

Question: Please help an MQ nubee to write his first Java Client, I got a little bit lost in the Oracle docs.
I have OpenMQ up and running.
In the OpenMQ Administration Console I established a broker named "MyFirstTest"
1 of 6 services is "jms" (which seems to be the most easy to use service), this service is up and running, too (saying: Service state running).
So I come to the interesting part.
How do I connect to the broker "MyFirstTest", then to send a message in, and last but least read this message perhaps from a second client.
I think I have to find the already existing queue instead of using
new com.sun.messaging.Queue
Any example or link to is appreciated.
<code>public class HelloWorldMessage {
public static void main(String[] args) {
    try {
        ConnectionFactory myConnFactory;
        Queue myQueue;

        myConnFactory = new com.sun.messaging.ConnectionFactory();
        Connection myConn = myConnFactory.createConnection();
        Session mySess = myConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        myQueue = new com.sun.messaging.Queue("MyFirstTest");

        //Create a message producer.
        MessageProducer myMsgProducer = mySess.createProducer(myQueue);

        //Create and send a message to the queue.
        TextMessage myTextMsg = mySess.createTextMessage();
        myTextMsg.setText("Hello World");
        System.out.println("Sending Message: " + myTextMsg.getText());
        myMsgProducer.send(myTextMsg);

        //Create a message consumer.
        MessageConsumer myMsgConsumer = mySess.createConsumer(myQueue);

        //Start the Connection created in step 3.
        myConn.start();

        //Receive a message from the queue.
        Message msg = myMsgConsumer.receive();

        //Retreive the contents of the message.
        if (msg instanceof TextMessage) {
            TextMessage txtMsg = (TextMessage) msg;
            System.out.println("Read Message: " + txtMsg.getText());
        }

        //Close the session and connection resources.
        mySess.close();
        myConn.close();

    } catch (Exception jmse) {
        System.out.println("Exception occurred : " + jmse.toString());
        jmse.printStackTrace();
    }
}
</code>
}
Comment: What have you tried so far? Any code? There is a lot of examples on the net how to create a JMS publisher or subscriber (it doesn't have to be OpenMQ-specific).
Comment: I tried the HelloWorldMessage example. But the example uses a new message queue.
Comment: [What have you tried?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) post some code please
Comment: Ok, I added the code example above. The example uses a NEW queue instead of the existing one.
Comment: @Alex004 where did you get this example? There are a couple of things that are done wrong. First of all, instead of creating the `Queue` object directly, you should use `Session.createQueue()` method. Irrespective of that , the code creates the queue only if it doesn't exist yet, otherwise the existing one is used.
Comment: I found examples at Oracle: http://docs.oracle.com/cd/E19798-01/821-1796/index.html
Answer: <code>//Assuming server supports multiple clients, your client can look like this:
//Ref: http://docs.oracle.com/javase/tutorial/networking/sockets/readingWriting.html
//untested code
class client{

 .....
 ....

 private static Socket echoSocket;

 //main can be in another class also
 public static void main(.... args[]){

   client nodeI,nodeII;
   nodeI = new client("speaker/sender");
   nodeII = new client("listener/recvr");
   nodeI.connect2Server();
   nodeI.sendMssgInstr2Server(node);

 }

 public void connect2Server(){

  try {
            echoSocket = new Socket("<jms.srvr.ip>", <port#>);
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host: <jms.srvr.ip>.");
            System.exit(1);
        }
 }

 public void sendMssgInstr2Server throws IOException (client RecipientClientNodeII){
   out = new PrintWriter(echoSocket.getOutputStream(), true);
   out.println("sending message:"+mssgQueue.poll() + " =>recipient client is now reading:"+RecipientClientNodeII.receive);
 }

public void receive(){
  try{
      in = new BufferedReader(new InputStreamReader(echoSocket.getInputStream()));
       }catch (IOException e) {
            System.err.println("Couldn't get I/O for "+"the connection to: <jms.srvr.ip>.");
            System.exit(1);
     }

  while(1)
    in.readLine();
 }

//other methods
  .......
  .......

}; //class client ends
</code>
Comment: hope this helps :) Please let me know if I got ur question all wrong :P
Comment: Hi MazakiyaDeciphered, why do you use such a low level connection as Socket? And in your example you are using 3 instances of "client". Why?


Is it possible to have a full window background image in a burn theme?

Question: When I set an Image to fill the window, it seems to render over the top of the other controls and generally make a mess of painting the window. The order in the file doesn't seem to help, however if I put it inside it's own Page section it behaves a little better.
Is there any way to display an image behind everything in the window?
Also, the other controls don't seem to render over the top of it properly when they do (text has white background, buttons have white squares), I'm guessing they need a transparent mode set somewhere?

Edit:
Here is an example of the problem, the button and checkbox became visible from mouseover, and the text from selecting:
Answer: I was not able to get the Image as a background to work, however I was able to get what I wanted using the window background.
The Window allows you to use an image specified in the Theme/@ImageFile, and then specify the Window/@SourceX and Window/@SourceY offsets to 0. However this is not enough, as the Windows referenced font background will override the window image background. You need to use a font without a background specified.

<Theme xmlns="http://wixtoolset.org/schemas/thmutil/2010"
    ImageFile="background.png">
    <Window Width="485" Height="300" HexStyle="100a0000"
        FontId="0" SourceX="0" SourceY="0">#(loc.Caption)</Window>
    Segoe UI

There are two other issues I had to work around:

The checkboxes dont obey the background colour but that's because of the common controls wixstdba uses, just have to deal with it.
The progress text changes but doesn't have its background repainted, so it draws over itself, worked around by giving it a background.
Comment: Your solution was very helpful. Thank you! I'd like to know how you had to deal with the checkboxes? Even if I set the font to be transparent, it still ends up having a white backgound. Same for Hypertext controls and progress bar text. What is your workaround for that? You said you give it a background. Can you please elaborate on that?
Comment: Hey @Thracian, a little late, but what I did was just accept the checkbox as is (possibly work around it in the image) and set the background colour of the font used for the progress text to have a white background also.
Answer: I've just found out a key field when attempting to theme WIX.

Visible="yes"

Does not mean the element visible.
It means the element is always visible. On every Page.
Answer: Yes, it is possible. If you have a static image that is the same for all pages in the theme then you can put the Image element above all the page elements. Optionally, if you want a different background per-page then put the image first in the page. I organize my theme like so:
<Theme>
   <Window />

   <Image />

   <Page>
      <Image />
      <other controls />

The order of the control elements defines the Z-order in reverse. The first control is on bottom and the controls down from there stack on top. That's why the background Image needs to be first.
As for transparent text, it is possible with varying levels of goodness. First to get rid of the white background, you need to remove the Background attribute from the Font element used for the transparent text. An absent Background attribute means use the null brush for the text, which is essentially transparent.
The levels of transparency goodness depends on the control. Checkboxes never seem to respect the transparent text. Also, transparent text does not work well if it gets redrawn. You'll see the old text left behind. So transparency only works on Text that isn't updated.
Anyway, hopefully the above gets you started. If you'd like to contribute to help improve transparency or theme's I recommend taking a look at the code in src\dutil\thmutil.cpp. Maybe you can us figure out how to make it work perfectly.
Comment: This isn't working for me, the image is drawn over the top initially, though when you move the mouse around the controls repaint over the image. I'll add some images and examples for thmviewer tomorrow.
Comment: Lol I was wondering why this was one of the few places on t'net that has an explicit understanding of the Themes for Wix. Should have known it was one of the contributors lol! Thanks Rob.
Comment: I frequent three places: my blog at http://robmensching.com/blog/, email@example.com mailing list, and StackOverflow `wix` tag. :)
Comment: redwyre - the z-order is unpredictable certainly (we have the progress bar currently rendering behind). The best tip I can give you is use the themeViewer, it removes the guess work!


Why do we care about two subgroups being conjugate?

Question: In classifications of the subgroups of a given group, results are often stated up to conjugacy.  I would like to know why this is.
More generally, I don't understand why "conjugacy" is an equivalence relation we care about, beyond the fact that it is stronger than "abstractly isomorphic."
My vague understanding is that while "abstractly isomorphic" is the correct "intrinsic" notion of isomorphism, so "conjugate" is the correct "extrinsic" notion.  But why have we designated this notion of equivalence, and not some other one?
To receive a satisfactory answer, let me be slightly more precise:

Question: Given two subgroups $H_1, H_2$ of a given group $G$, what properties are preserved under conjugacy that may break under general abstract isomorphism?

For example, is it true that $G/H_1 \cong G/H_2$ iff $H_1$ is conjugate to $H_2$?  Or, is it true that two subgroups $H_1, H_2 \leq \text{GL}(V)$ are conjugate iff their representations are isomorphic?  I'm sure these are easy questions to answer -- admittedly, I haven't thought fully about either -- but I raise them by way of example.  What are other such equivalent characterizations?
Comment: Note that $H_1$ is normal if and only if there are no other conjugate subgroups to $H_1$. So it's not very interesting to assert that $G/H_1 \simeq G/H_2$ when $H_1$ and $H_2$ are conjugate subgroups, and both normal.
Comment: Are we assuming $H_1$ and $H_2$ normal?
Comment: @goblin: not necessarily.  To endow $G/H_1$ and $G/H_2$ with group structures, then yes, I should have added normality in that line; I was being careless.
Comment: So many good answers in such a short time. Peeps are really up on their algebra!
Answer: This answer isn't of the form you asked for, but I'm posting it because it's been very helpful to me. I apologize if this is the sort of answer you're trying to avoid.
Let's start with a very specific situation. Let $G$ be the isometry group of the plane $E$. If you pick a point $x$, the rotations around $x$ form a subgroup $G_x$ of $G$. If you pick two different points $x$ and $y$, you get two subgroups $G_x$ and $G_y$. These subgroups are different, but they don't feel really different, because you can turn one into the other just by changing your point of view: if you shift the plane by an isometry that puts $x$ where $y$ used to be, then $G_x$ becomes the subgroup $G_y$ used to be. In other words, $G_x$ and $G_y$ aren't really different because there's an isometry $g \in G$ that makes the diagram
$$\require{AMScd}
\begin{CD}
E @>G_x>> E \\
@VgVV @VVgV \\
E @>>G_y> E
\end{CD}$$
commute. (In this diagram, each arrow stands for a whole set of isometries, with $E \overset{g}{\longrightarrow} E$ denoting the singleton $\{g\}$, and composing arrows means composing all pairs of isometries.)

Now, to be completely general, think of any group $G$ as a group of "allowed symmetries" of some object—in other words, a subgroup of $\operatorname{Aut} X$ for some object $X$. (This is completely general because we can take $X$ to be $G$ itself with the left multiplication action. Perhaps more satisfyingly, we can make $X$ a graph if $G$ is finite, a tree if $G$ is free, an effective Klein geometry if $G$ is a suitable Lie group...)
Once again, even if two subgroups of $G$ are different, they don't feel really different if you can turn one into the other just by looking at $X$ from a different point of view. In other words, two subgroups $H, \tilde{H} < G$ aren't really different if there's an allowed symmetry $g \in G$ of $X$ that makes the diagram
$$\require{AMScd}
\begin{CD}
X @>H>> X \\
@VgVV @VVgV \\
X @>>\tilde{H}> X
\end{CD}$$
commute. This, of course, is the definition of conjugacy.

This point of view, by the way, is my favorite motivation for the idea of normality: a normal subgroup is a class of symmetries that doesn't depend on your point of view. If you shift the plane by an isometry, for example, your notion of what counts as a horizontal translation might change, but your notion of what counts as a translation won't. Horizontal translations form a non-normal subgroup, while translations form a normal subgroup.
Comment: I like this point of view too, and have been slowly thinking about a similar answer to a different question! But I'm curious: What exactly is going on with this map $X \overset{H}{\to} X$ in your second diagram?
Comment: Right, @pjs36, I should have said what I meant. I've edited the answer to clarify. Each arrow in the diagram stands for a whole set of maps, with $X \overset{g}{\longrightarrow} X$ denoting the singleton $\{g\}$, and composition means composition of all possible pairs. This mirrors the common notations $gH$ for cosets and $KH$ for products of subgroups.
Comment: Thanks! I realized after a bit that that must be what it meant, I just couldn't put it all together at first. I do like the interpretation and connection with $gH = Hg$, very nice.
Comment: @pjs36, glad you like it!
Answer: $H_1$ and $H_2$ are conjugate as subgroups iff $G/H_1$ and $G/H_2$ are isomorphic as $G$-sets.
Edit: Two related settings where this condition shows up are Galois theory and covering space theory. One way to state the classification of (not necessarily connected) covering spaces of a (nice, path-connected) space $X$ is that the category of such covers is equivalent to the category of $\pi_1(X)$-sets. Among these, the transitive $\pi_1(X)$-sets correspond to the connected covers, so we get that connected covers correspond to conjugacy classes of subgroups of $\pi_1(X)$. To get subgroups on the nose you need to pick basepoints in the covers lifting a basepoint in $X$.
Edit #2: Here is another setting where this condition appears, to whet your appetite. If $H_1$ and $H_2$ are isomorphic, then their categories $\text{Rep}(H_1)$ and $\text{Rep}(H_2)$ of linear representations are equivalent. But if $H_1$ and $H_2$ are conjugate, it's furthermore true that we can choose an equivalence between these categories to have the property that the corresponding induction functors $\text{Ind}_{H_i}^G : \text{Rep}(H_i) \to \text{Rep}(G)$ are naturally isomorphic.
Comment: This is probably too similar to warrant a different answer, so I'll post it as a comment on this. If you take a representation of $G$ and restrict it to two abstractly isomorphic subgroups $H_1$, $H_2$ the restrictions may not be isomorphic as representations under any identification, but for two conjugate representations they are.
Comment: I second the comment by Nate. See the importance of "trace of Frobenius" in understanding the statements of various theorems and conjectures arising from the area surrounding the study of Galois representations.
Comment: The statement was asked as a question at http://math.stackexchange.com/questions/579642
Comment: Good answer. See [here](https://en.wikipedia.org/wiki/Group_action#Morphisms_and_isomorphisms_between_G-sets) for the relevant definitions.
Answer: I will not attempt a complete answer, but just as an example, if you are studying finite simple groups $G$ (which lots of people do), then one of the first questions you might ask about $G$ is: what are its maximal subgroups? A complete list would be unmanageably long, whereas a list of conjugacy class representatives provides all of information you would need. In this case, the number of conjugates of a maximal subgroup $M$ is equal to $|G:M|$ so you know exactly how many of them there are.
A list of isomorphism class representatives would not be useless, but would leave you with unanswered questions, such as how many maximal subgroups there are altogether. For example, for ${\rm PSL}(2,7)$, there are just two such $S_4$ and a nonabelian group of order $21$. It turns out that there is a unique conjugacy class of the second of these (it is actually the normalizer of a Sylow $7$-subgroup, so that is clear), but two conjugacy classes of $S_4$, which are conjugate in the automorphism group of ${\rm PSL}(2,7)$, which is ${\rm PGL}(2,7)$.
In fact in general, whenever you have isomorphic but not conjugate subgroups, then you will be interested in knowing whether they are conjugate in ${\rm Aut}(G)$.
Comment: You talk about "$G$" in the second paragraph, but do not define it.
Comment: I meant ${\rm PSL}(2,7)$ - I have edited it.
Answer:
I don't understand why "conjugacy" is an equivalence relation we care about, beyond the fact that it is stronger than "abstractly isomorphic."

An observational fact about conjugacy: things are conjugate if they do "the same thing" relative to different perspectives. For instance, consider:

Conjugating a permutation relabels the entries in its two-line notation (top and bottom row), or equivalently relabels the entries in its cycle notation. The ralabelling is according to the permutation one conjugates by.
Conjugating a matrix represents change in coordinates. Given a linear transformation, two (ordered) bases, and two corresponding representations of the linear map with respect to the bases as matrices, the two matrices are conjugate by the change-of-basis matrix.
Conjugating a loop in a pointed fundamental group by a path yields a loop around a possibly different basepoint obtained by dragging the original loop along said path.
Two linear representations are equivalent precisely when they are conjugate by some intertwining aka equivariant isomorphism.

Caveats: the first two examples are about conjugating individual elements of groups, the last two examples may just as easily involve conjugating by things outside of a group in order to move between distinct groups, and the last example involves conjugating a group homomorphism pointwise rather than a subgroup. But the principle is still the same.
The highest calling a group can have in life is to act on something, so it is more than just an abstract algebraic structure isolated from the world. To this end, groups are to group actions as potential energy is to kinetic energy, except with symmetry instead of energy. In this spirit, there should be some action-related interpretation of subgroups which helps us understand why conjugation should be important and why it appears in nature as in the above examples. The idea is that any subgroup is potentially a point-stabilizer.
Point-stabilizers are significant because of the orbit-stabilizer theorem. While usually cast as a quantitative identity, we can instead think of OS as something richer: given any point in a space/set, the act of applying group elements to that chosen point induces a "covering" of the point's orbit by the group itself. The fibers of this map are precisely the cosets of the point's stabilizer. Indeed, under nice conditions, we can say Stabilizer → Group → Orbit is a fiber bundle, so the group is a bunch of copies of the stabilizer parametrized by the orbit.
Where then does conjugation enter into the picture? Well, two point-stabilizers are conjugate by a group element whenever that group element takes the one point to the other. Examples:

In the (orientation-preserving component of) Euclidean group of rigid motions of space, the stabilizer of a chosen point is the subgroup of rotations around that point. Two such rotation subgroups are conjugate by the translation which shifts one point to the other.
In the affine group of space, the stabilizer of a point are the "linear maps" of the vector space obtained by treating that point as the origin. Two such stabilizers are again conjugate by a translation between points.
With wallpaper groups, or higher-dimensional space groups more generally, the stabilizers are called crystallographic point groups, and they are once again conjugate by translations (those in the lattice of such that are symmetries of the original tiling or crystal).
In the isometry group of the hyperbolic plane, stabilizers are once again "rotation" subgroups, and they are also again conjugate by elements of a special subgroup acting regularly on the hyperbolic plane by "translations" similar to the above examples, but in this case there is no linear structure at all in the situation. This generalizes to higher dimensions too.
In the dihedral group acting on a regular polygon, the point stabilizers are flips across bisecting lines through vertices, two of which are conjugate by the rotation that moves the first vertex to the second. This is a discrete case, of which there is a continuous analogue: the orthogonal group acting on the circle.
With an orthogonal group acting on a higher-dimensional sphere, the stabilizer of a vector is canonically isomorphic with the orthogonal group of the vector's orthogonal complement, and these stabilizers are also conjugate by rotations.

Often other subgroups too may be compared or contrasted based on what they do in the group action, and this is reflected by conjugacy. We can see this with some one-parameter subgroups:

Given any collection of orthogonal, oriented planes in space and a "speed" associated with each plane, there is a one-parameter subgroup which restricts to rotations of these individual planes at their associated speeds along their orientation. In fact, these are all one-parameter subgroups. Conjugating it by a chosen rotation yields a new one-parameter subgroup: one just applies the chosen  rotation to all of the individual orthogonal, oriented planes to get the new collection of planes (whilst keeping the speeds).
Beyond the point-stabilizers which act like rotation groups in the hyperbolic plane, there are two other types of actions: those that rotate around a "point at infinity" (so on the boundary in Poincare's disk model) and those that make points flow on either side of a given geodesic. Both types yield one-parameter subgroups. Two "rotation groups" around two different "points at infinity" are conjugate by an element of the aforementioned regular subgroup that moves the one point to the other. Similarly, two "geodesic river flows" are conjugate by the element of the regular subgroup that moves one geodesic to the other.
Comment: The Stabilizer → Group → Orbit fiber bundle picture is lovely. I'm sure someone's tried to show it to me before, but it never clicked until I read this aswer. Thanks for mentioning it!
Comment: "The highest calling a group can have in life is to act on something": what a nice phrase this. May I ask if it's due to yourself or else could you point to a reference? Also could you expand on the energy analogy?
Comment: @AlpUzman Due to myself. Generally when groups act on things, we think of the action as some kind of "motion," hence kinetic. An abstract group has the potential to act on things if we so choose to let it.
Comment: Thanks! I think the energy analogy in this aspect is a little misleading; groups and group actions are as far as i can tell more intimate than different flavors of energy; they are more like "time" and "motion", both of which are intimately related to "change". For instance a differential equation determines a flow ("motion"), whose associated notion of "time" is the additive group of real numbers.
Comment: @AlpUzman There's a difference between potential and actual. When you're talking about a particular group action, it is "actual," but if you're talking about an abstract group (e.g. in any context where one says "let $G$ be a group..." with no assumption of what the group elements actually are or do), it merely has the potential to act in various ways. I agree with your descriptor of "motion," which is why I used the word "kinetic" in the potential vs. kinetic distinction.
Answer:
In classifications of the subgroups of a given group, results are often stated up to conjugacy. I would like to know why this is.

Conjugacy is important in Galois-like bijections: pointed covering spaces of a (nice) pointed space $(X,x)$ are classified by subgroups of the fundamental group of $X$, and conjugacy classes represent different choices of points lying over $x$. Similarly, conjugate subgroups of the Galois group $G$ of an extension $E/K$ correspond to conjugate subextensions, that is, subextensions $F,F'$ such that $\sigma F=F'$ for some automorphism $\sigma/K$. In the lines of what you mentioned, conjugate matrices are those that give isomorphic $F[X]$-module structures on a finite dimensional $F$-vector space $V$. This is essentially what many people learn in a not-so-introductory linear algebra course: the Jordan canonical form is the answer (sometimes) to "when are two matrices (representations) conjugate?", say!
The problem of conjugacy is thus well motivated! A slightly duller example is that conjugacy classes of a group give the dimension of $Z(kG)$ over $k$ and in fact give a canonical representative. I recall having attended a talk where it was vaguely mentioned that conjugacy classes plus something else classify Yetter-Drinfeld modules over the Hopf algebra $kG$. (Add: checking Wikipedia, you want $k=\Bbb C$, and modules are classified by a conjugacy class say $\overline g$ and an irreducible representation of the centralizer of $g$ in $G$).
Answer: Conjugacy of subgroups has important meaning in applications to topology and geometry. The vague idea is that homotopy relative to a base point preserves elements and subgroups of fundamental groups, but allowing the base point to move freely only preserves conjugacy classes. Here are some explicit examples.
-- Suppose that $G$ is a torsion free group and that $G = \pi_1(X)$ for some sufficiently nice path connected space $X$ (such as a manifold or CW complex). In this situation the conjugacy classes of infinite cyclic subgroups of $G$ correspond one-to-one with the nontrivial homotopy classes of continuous maps $f : S^1 \to X$ up to precomposition by a self-homeomorphism of $S^1$.
-- For a more geometric version of the above example, suppose furthermore that $X$ is a compact, connected, negatively curved Riemannian manifold. Then the conjugacy classes of infinite cyclic subgroups of $\pi_1(X)$ correspond one-to-one with maps $S^1 \to X$ that are reparamaterized local geodesics (up to precomposition by an isometry of $S^1$).
-- In a more general vein, if $X,Y$ are path connected CW complexes and if both are Eilenberg-Maclan spaces, then the conjugacy classes of subgroups of $\pi_1(Y)$ isomorphic to $\pi_1(X)$ correspond one-to-one with the homotopy classes of continuous maps $f:X \to Y$ modulo precomposition by self-homotopy equivalences of $X$.
Answer: It has already been mentioned by arctic tern mainly by giving examples and is implicit in the answers of others, but just to make it more explicit. There is a close connection between the action of a group $G$ on a set $\Omega$ and its point stabilizers $G_{\alpha} = \{g \in G: \alpha^g = \alpha\}$ for $\alpha \in \Omega$. The action on each orbit is equivalent to the action of a point stabilizer on that orbit and we have that the point stabilizers on each orbit are conjugate and $G_{\alpha}^g = G_{\alpha^g}$,  If $G$ acts transitive, this is key to the observation that for a point $\alpha$ the other points fixed by $G_{\alpha}$ are $\alpha^{N_G(G_{\alpha})}$ and by orbit-stabilizer we have $|N_G(G_{\alpha}) : G_{\alpha}|$ points that are fixed by $G_{\alpha}$ and each element that acts on the fixed point of $G_{\alpha}$ normalizes $G_{\alpha}$, hence conjugation and fixed points are closely related. Taking this further, if we have a single $g \in G_{\alpha}$, the total number of points fixed by $g$ is $|N_G(G_{\alpha}) : G_{\alpha}| \cdot k$, where $k$ denotes the number of distinct conjugates of $G_{\alpha}$ that contain $g$. If for example different point stabilizers intersect trivially (a situation that is not that uncommon), $\alpha^{N_G(G_{\alpha})}$ is precisely the set fixed by every single $g \in G_{\alpha}$. This is sometimes useful if you look at groups on which several restrictions on the fixed points of nontrivial elements are imposed.
Also as mentioned by Qiaochu Yuan two subgroups are conjugate iff the action on the cosets are equivalent. Further two transitive actions on two sets $\Omega, \Gamma$ of $G$ are equivalent if every point stabilizer of the action on $\Omega$ is also a point stabilizer of the action on $\Gamma$, and vice versa. Which is just another way to say this by the fundamental relation between conjugate point stabilizers and the points fixed by elements of $G$.
Answer: Isomorphic subgroups can be normal and not normal, which can be seen by taking the product of a group and a non-normal subgroup. So conjugacy can be seen in contrast as a reliable means of inferring the normality of many subgroups from one.
If you don't know representation theory as it's founded today, conjugacy of subgroups helps you imagine physical interpretations for the group, in that conjugacy of symmetry groups often replicates subgroups as a physically meaningful unit to other physically analogous units, such as in an affine space with its affine group, where conjugating by a translation takes the group of rotations about one point to another. This may still be relevant if you're looking for specific semantics, such as a Galois representation or representation by automorphisms of a simplicial complex.


Tuning machines are too sensitive and change the pitch too much. What should I do?

Question: I have just bought a steel guitar (actually a 10-string brazilian viola) and the tuning is too sensitive, because only a small movement on the peg changes the pitch too much. It's not an exaggeration to say that the "useful range" of movement is less than 5 angular degrees, and this is way different of what I got used in other instruments.
I suspect this might be due to two possible causes:

The machine heads turning ratio is poor;
The strings are too low-quality;

So, the questions are:

What is the expected turning ratio (handle revolutions per axis revolution) of a good-quality guitar machine head?
Is it possible that bad quality strings are the cause for my problem? Should I expect the tuning process to be easier with better strings?

Here's an image of the tuning machine model, taken from the manufacturer site:
Comment: Do you find that the strings squeak or make another sudden noise as you tune and they respond?  This may be the result of the strings getting stuck in the nut and as you try to tune them, a certain amount of tension is needed to un-stick from the nut, which will typically cause the pitch to jump a bit, not allowing you to make small adjustments.
Comment: I'm guessing I'm off based on your description but thought it may be the case.
Answer: It is likely that the nut slots are too tight and the strings are sticking.  When they respond to the tuning peg, they are actually slipping and so you aren't getting a gradual change in pitch.
Next time you restring the instrument, try thinner strings (maybe it was set up that way) and you could consider putting some graphite powder in the slots as a dry lubricant so the strings glide through easier.
Ultimately, you may need to go to a luthier to have the instrument adjusted in some way (either tuners, nut, strings, etc).
Comment: @heltonbiker  your last sentence probably nailed it.  You need to learn to tune  with a gentle hand.  In addition, machine heads have a ton of hysteresis, so you're best off **always** tuning up from below.  If you go over, detune low and approach again.
Comment: Hi, thanks for your answer! Actually I don't think this is the problem, because: 1) I have this problem in other instruments, it is very characteristic - to the point of an autible "twang" when the string unsticks and slides - and it actually responds to graphite. But the symptoms are quite different and I don't see them in my current case; 2) The variation in pitch _is_ actually continuous and gradual, but it is too steep. Finding the exact pitch involves a _sub-milimetrical_ hand movement, but I am able to control it quite well. I just lack that "micro-tuning" feel, having only the gross one
Comment: @heltonbiker for reasons I do not understand, older strings can be harder to tune accurately.  Sometimes a string change takes care of the issue
Comment: @heltonbiker you may also have dead strings, which are harder to tune accurately.
Comment: Paul, can you elaborate on the "dead strings" issue? How is that a problem for tuning? The current strings came with the instrument, so I bet they are a bit old and quite low quality. On the other hand, they look brand new and sound fine (not great) once in tune.
Answer: Strings DO stretch when a new set is fitted. as well as taking up any slack in the windings on the tuning heads. All tuners only work accurately when tuning UP to pitch. After first time up, lift string over sound hole about 15-25mm and hold a few seconds. Tune again, repeat process 2-3 times, play guitar a while, bending notes also helps stretch and settle strings. They'll keep stretching for 2-3 days depending on how much you play and retune. If strings grab at nut as tuning, a tiny drop of any oil on the nut slots will stop it.
Answer: Sometimes stretching a string a bit, by pulling out on it, helps.  At least I know that's what piano tuners do when they can't get a string to the right pitch, and I assume it would work on guitar or any other string instrument as well.
Comment: Steel string do not actually stretch (believe it or not).  But the technique is still valid.  The technique tightens the wraps around the post and anywhere else there could be slack.  But this would not match the symptoms of the original question.  I believe nylon strings actually do stretch.


Cannot log in to RStudio server after upgrading versions

Question: I had RStudio Server v0.98.1103.
In my nginx config file, I added the following lines so that I can access it from /rstudio instead of :8787
location /rstudio/ {
  proxy_pass http://127.0.0.1:8787/;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
}

I just updated to v0.99.896.  Now when I go to the /rstudio URL and put in my credentials, it just goes back to the same login screen.  If I put it wrong credentials then I do see an error, but if the credentials are right then the page simply "refreshes".
If I go to :8787 then I'm able to login.
Does anyone have any ideas why I can't login anymore?
Edit: When I downgrade back to the previous version, I can log in again.
Comment: Not a direct answer, but does anything in https://support.rstudio.com/hc/en-us/articles/200552326-Running-RStudio-Server-with-a-Proxy help?
Comment: @KevinUshey I just tried exactly the same conf settings as in that article, still seeing the same behaviour (click login, the page goes back to the same page all the time). After downgrading to the previous version, I can log in again. I'll try installing it on a fresh machine later to better isolate it
Comment: What is your environment? I mean distro. And uname -a?
Comment: I cannot reproduce it.
Answer: There are a few things missing from your config file. See this article for details on how to configure an nginx proxy to use an /rstudio prefix: https://support.rstudio.com/hc/en-us/articles/200552326-Running-RStudio-Server-with-a-Proxy
This is what the complete config should look like:
http {

  map $http_upgrade $connection_upgrade {
      default upgrade;
      ''      close;
  }

  server {
    listen 80;

    location /rstudio/ {
      rewrite ^/rstudio/(.*)$ /$1 break;
      proxy_pass http://localhost:8787;
      proxy_redirect http://localhost:8787/ $scheme://$host/rstudio/;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
      proxy_read_timeout 20d;
    }
  }
}

Comment: Thanks JJ. I did try adding those exact lines to my nginx config but it didn't change anything. Using this config did work on a brand new fresh machine, but there must be something else about my environment/configuration that is clashing with this.


Does $\sum_{n=2}^{\infty} \frac{(-1)^n}{\ln(n)}$ have a closed form?

Question: I was considering the sum $ \sum_{n=2}^{\infty} \frac{(-1)^n}{\ln(n)} $  which I realizes converges extremely slowly (due to the slow growing nature of the logarithm). I was curious if someone knew a closed form for this in terms of literally ANY OTHER functions? Plugging this into Wolfram alpha didn't reveal anything particularly interesting:
https://www.wolframalpha.com/input/?i=sum+%28-1%29%5En%2F%28ln%28n%29%29+n+%3D2+to+infinity
I suppose that a good place to start would be try to understand the function $$ \sum_{n=2}^{\infty} \frac{x^n}{\ln(n)} $$
And then evaluate it at $x=-1$. This function also was unfamiliar to me, so I tried to look at the even simpler object:
$$ \sum_{n=1}^{\infty} \ln(n)x^n $$
Which does happen to have a restatement as a lambert series: See here: https://en.wikipedia.org/wiki/Lambert_series#Examples (particularly the section called Von Mangoldt Function). But even that series seems to be dependent on properties of prime numbers (perhaps there might be a way to get the riemann zeta function involved).
Related:
Generally speaking $\sum_{n=1}^{\infty} \frac{(-1)^n}{n^q} $ for small rational q (ex: $q = \frac{1}{2}$ or $q = \frac{1}{3}$) could be resolved using the riemann zeta function. The next slowest growing function that I could think of beyond polynomial roots was a logarithm which motivates this question.
Answer: Consider the series
$$f(x) = \sum_{n=2}^\infty \frac{(-1)^nn^x}{\log n}$$
Then
$$f'(x) = \sum_{n=1}^\infty (-1)^n n^x + 1 = 1 - \eta(-x) = 1 + (2^{1+x}-1)\zeta(-x)$$
where $\eta$ and $\zeta$ are the Dirchlet eta and Riemann zeta functions, respectively. Then the summation is given by
$$f(0) = \int_{-\infty}^0 1 - \eta(-x)\:dx = \int_0^\infty 1 - \eta(x)\:dx \approx0.9243$$
Answer: Similar to Ninad's answer.
Use the polyogarithm
$$
\operatorname{Li}_s(z) = \sum_{k=1}^\infty\frac{z^k}{k^s},\qquad |z|<1 .
$$
Then
$$
\operatorname{Li}_s(z) - z = \sum_{k=2}^\infty\frac{z^k}{k^s}
\\
\int_0^\infty \big(\operatorname{Li}_s(z) - z\big)\;ds =
 \sum_{k=2}^\infty\frac{z^k}{\log(k)}
$$
Compare this to
$$
\frac{\partial^n}{\partial s^n} \operatorname{Li}_s(z)
= \sum_{k=1}^\infty \frac{z^k(\log k)^n}{k^s}
\\
\frac{\partial^n}{\partial s^n} \operatorname{Li}_s(z)\Big\vert_{s=0}
= \sum_{k=1}^\infty z^k(\log k)^n
$$


Proof-verification exercise problem

Question: Let $a_1=2$, $a_2=4$, and define for $n > 2$, $n$ a natural number:

$$a_n=\:a_{n-1}+2a_{n-2}$$

How to prove that $a_n\:\ge \:2^n$ is always true?
When n = 3

$$a_3=a_{3-1}+2a_{3-2}\:=a_2\:+2a_1=4\:+2\cdot 2=8$$
  $$2^3=8$$

when n +1

$$a_{n+1}=a_{n+1-1}+2a_{n+1-2}=a_n+2a_{n-1}$$
  $$2^{n+1}$$
Comment: How can we verify your proof if you don't show us what it is?
Comment: At a minimum, you have surely checked this numerically for modest $n$.  If you did that, you probably noticed a pattern...no?
Comment: try an induction on n
Comment: I tried induction, but somehow i wasn't able to prove it.
Comment: Welcome to the site!  So you are aware, this is not a homework site.  People don't usually respond to questions that show no efforts.  You describe this as "proof-verification" which would suggest that you have some proof that you'd like us to review.  Glad to do it!  Just write out what you've got and I, or others, will certainly look it over.
Answer: The associate caracteristic equation is
$x^2-x-2=0$ which has $x=-1$ and $x=2$ as solutions.
thus
$u_n=a(-1)^n+b(2)^n$.
with
$-a+2b=u_1=2$ and
$a+4b=u_2=4$
so
$b=1$ and $a=0$.
thus, we get
$u_n\color{red}{=}2^n$ for each integer $ n$.
Answer: Assuming that $a \ge 0$:
Start of indudction: n = 3
$$a_3 = a_2 + 2a_1 = 4 + 2*2 = 8 \ge 2^3$$
Thus
$$a_n \ge 2^n$$
for an $n \in \mathbb{N}$.
Induction Step: $n \rightarrow n+1$
$$a_{n+1}=a_n + 2a_{n-1}$$
Since
$$a_n \ge 2^n$$
$$\Rightarrow a_n + 2a_{n-1}\ge 2^n $$
Comment: How do you get the last line? :) I don't really get it.
Comment: @Mari You are right, I messed something up and now I'm trying to get the solution as well, but nothing is quiet working.
Comment: @Mari When rearranging you always simply proof that the term is bigger than 2^{n-k} , k \ge 0, so there has to be a logical step to proof that it's also bigger than 2^{n+1}, but I can't point my finger to it.

Proof-verification exercise problem


Specifying repeats and positions for background when using multiple backgrounds

Question: I'm trying to apply two background images. One is a repeating block of colour I'd like to have repeating along the x axis. The other is just a single image I'd like to only appear once.
I've used multiple background images to try and get the two images applied to the same div, however I'm not sure how to target specific background rules to each of the backgrounds.
Background 1 needs to have a position of top and repeat-x.
Background 2 needs to have a position of top right and no-repeat.
Is this possible with multiple backgrounds or will I have to go back to the old way of two separate divs nested?
JS Fiddle: http://jsfiddle.net/nnq4S/
The grey background should span the entire top of the container whereas the ribbon should stay put.
Answer: I don't have a test handy, but does this work?
<code>background:url(bg1.png) top left repeat-x, url(bg2.png) top right no-repeat;
</code>
Comment: Apologies I've just added a JS. I'll try this now though :)
Comment: Hi yes this works! Thanks! So I just need to put in my shorthand background properties and separate the two with a comma. Great thanks :)
Comment: I'm pretty sure you can also use commas in longhand notation too: `background-repeat:repeat-x, no-repeat;`


Como ordenar consulta utilizando PDO?

Question: Como posso ordenar a minha consulta da data mais recente para a mais antiga.
Essa é a minha Query ?
public function RetornaAtualizacoesFuncionarios($data,$codusuario){
    $WHERE = array() ;
    if( !empty( $codusuario    ) ) {$WHERE[] = "codusuario = $codusuario";};
    if( !empty( $data   ) ) {$WHERE[] = "DATE_FORMAT(data,'%Y-%m') = '$data'";};
    $WHERE[] = "tipregistro = 'mysql'";

try {

     $Query = "SELECT
                    DISTINCT(funcionarios.usuario),
                    date_format(funcionarios.data,'%d/%m/%Y %H:%i:%s') as data ,
                    codigo,
                    nome
                        FROM funcionarios
                                  ";

    if( !empty($WHERE) )$Query .= ' WHERE '.implode(' AND  ', $WHERE );

    // echo "
"; print_r($Query);

    include_once $_SESSION['pmodel'].'/mysqlconnection_class.php';
           $p_sql = MysqlConnection::getInstance()->prepare($Query);

            $_retorno = array();
            if($p_sql->execute()) {
                while ($_result = $p_sql->fetch(PDO::FETCH_ASSOC))  {
                    $_retorno[] = $_result;
                }
            }
            return $_retorno;
        } catch (PDOException $e) {
            echo $e->getMessage();
        }
    }
}

Answer: Basta adicionar a clausula ORDER BY na sua query complamentada com o DESC:
$Query = "SELECT
                DISTINCT(funcionarios.usuario),
                date_format(funcionarios.data,'%d/%m/%Y %H:%i:%s') as data ,
                codigo,
                nome
                FROM funcionarios";

if( !empty($WHERE) )$Query .= ' WHERE '.implode(' AND  ', $WHERE );

$Query .= " ORDER BY funcionarios.data DESC";

Comment: bem conseguir colocando o ORDER BY funcionarios.data DESC  no fim do $WHERE
Comment: Mas dessa forma da esse seguinte erro SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE codusuario = 16 AND DATE_FORMAT(data,'%Y-%m') = '2016-10' AND tipregistr'
Comment: desculpe, não vi que você inseria o `WHERE` depois, o `ORDER BY` tem que vir por último, vou editar a resposta.
Comment: Isso ai, editei a resposta!
Comment: Bom funcionou dessa forma também , obrigado.
Comment: Não esqueça de marcar a resposta correta caso tenha ajudado! ;)

Como ordenar consulta utilizando PDO?


Independence of random variables involving Brownian motion

Question: I am reading a book on stochastic analysis and I don't understand the following (i.e. don't know how to prove it rigorously):
Let $B$ be a standard Brownian motion and $\{ \mathcal{F}_t \}$ be the filtration generated by the Brownian motion. Let $s \geq 0$, $t_n > \ldots > t_1 \geq 0$ be fixed real numbers.
Then for any Borel function $f: \mathbb{R}^n \rightarrow \mathbb{R}$, $f(B_{t_1 +s} - B_s, \ldots, B_{t_n +s} - B_s)$ is independent of $\mathcal{F}_s$.
My approach:
I plan to apply the Dynkin's lemma. Let $X_i = B_{t_i +s} - B_s$. I note that
\begin{equation}
\sigma (f(X_1, X_2, \ldots, X_n)) \subseteq \sigma \bigg( \bigg\{ \{X_1 \leq x_1\} \cap \ldots \cap \{X_n \leq x_n\} \, \bigg|\, x_1, x_2, \ldots, x_n \in \mathbb{R} \bigg\} \bigg)
\end{equation}
and I know that $\bigg\{ \{X_1 \leq x_1\} \cap \ldots \cap \{X_n \leq x_n\} \, \bigg|\, x_1, x_2, \ldots, x_n \in \mathbb{R} \bigg\} $ is a $\pi-$system.
However, I can't show that
$$\mathbb{P} ( \{X_1 \leq x_1\} \cap \ldots \cap \{X_n \leq x_n\} \cap A) = \mathbb{P} (\{X_1 \leq x_1\} \cap \ldots \cap \{X_n \leq x_n\}) \mathbb{P} (A), \quad \forall A \in \mathcal{F}_s.$$
Any ideas?
Comment: Do you know that $(B_{t+s})_{t \geq 0}$ and $\mathcal{F}_s$ are independent?
Comment: @saz I am actually reading the proof of this, but it uses this fact, so it would be a circular argument if you use this fact.
Answer: Hint: Set $Y_k = B_{t_k + s} - B_{t_{k-1}+s}$ where $t_0 = 0$.  Note that $X_k = Y_1 + \dots + Y_k$, so you can express $f(X_1, \dots, X_n)$ as a Borel function of $Y_1, \dots, Y_n$.  Now observe that $\{\mathcal{F}_s, \sigma(Y_1), \dots, \sigma(Y_n)\}$ are mutually independent $\sigma$-fields.  Use a Dynkin lemma argument to conclude that $\mathcal{F}_s$ and $\sigma(Y_1, \dots, Y_n) = \sigma(\sigma(Y_1), \dots, \sigma(Y_n))$ are independent.


Affineness of the algebra of formal power series?

Question: Let $\mathbb{k}$ be a field and $A$ be a commutative $\mathbb{k}$-algebra. It is clear that when $A$ is an affine $\mathbb{k}$-algebra (that is, $A$ is finitely generated as a $\mathbb{k}$-algebra), the polynomial algebra $A[x]$ is affine both as $\mathbb{k}[x]$-algebra and $\mathbb{k}$-algebra. So it is natural to ask if $A[[x]]$ is affine as a $\mathbb{k}[[x]]$-algebra when $A$ is affine? (I know that $A[[x]]$ is not affine as a $\mathbb{k}$-algebra in general).
Intuition says no, but I have no idea how to prove or disprove it. After some thinking, I found that suppose $A$ can be generated by $\{a_{1},...,a_{m}\}$, then $A[[x]]$ may not be generated by $\{a_{1},...,a_{m}\}$ as a $\mathbb{k}[[x]]$-algebra in general. For example, consider the polynomial algebra $A=\mathbb{k}[y]$, which can be generated by $y$ . It is clear that $\mathbb{k}[[x]][y]\subsetneq \mathbb{k}[y][[x]]=A[[x]]$. And now I feel stuck.
Can you give me a hint or something more? Thanks!
Answer: Suppose that $k$ is any ring and $V$ is $k$-module that is not finitely generated.  Then I claim that $V[[x]]$ is not countably generated as a $k[[x]]$-module.  In particular, if $V$ is additionally a $k$-algebra, this implies $V[[x]]$ is also not countably generated as a $k[[x]]$-algebra.
To prove this, take any countable sequence of elements $(f_n)$ in $V[[x]]$; we will show it does not generate $V[[x]]$ as a $k[[x]]$-module.  Since $V$ is not finitely generated, for each $n$ we can pick an element $a_n\in V$ which is not in the submodule generated by any of the coefficients of $f_0,\dots,f_n$ for powers of $x$ less than or equal to $n$.  Now consider the element $a=\sum a_nx^n\in V[[x]]$.  If $a$ were a $k[[x]]$-linear combination of $f_0,\dots,f_n$, then for each $m$, $a_m$ would be a $k$-linear combination of the coefficients of $f_0,\dots,f_n$ for powers of $x$ less than or equal to $m$.  But by construction, this is false for $m=n$.  Thus $a$ cannot be a $k[[x]]$-linear combination of $f_0,\dots,f_n$ for any $n$, so it is not in the submodule generated by the entire sequence $(f_n)$.
Comment: If $A$ is generated by an algebra by elements $a_i$, then it is generated as a module by the set of all products of the $a_i$.
Comment: Thank you for your answer, Eric. As you said, $V[[x]]$ is not countably generated as a $k[[x]]$-module when $V$ is a $k$-module that is not finitely generated, and hence my question has been answered very well.   But I wonder why a commutative algebra , say $A$, over a commutative ring $R$ that is countably generated as an $R$-algebra must be countably generated as an $R$-module? I can only see that any commutative affine $R$-algebra is countably generated as an $R$-module.
Comment: You are right. What I wanted to ask before is why the set of all products of the $a_{i}$ is countable.  But now I understand~ Thanks!


Which distributed filesystem will actually fit my needs?

Question: Hear me out
I have seen the question asked (in different forms) here, here, and perhaps the best one I found was here, but I do not think this is a duplicate because quite some time has past since those questions were asked, and my question has its own nuances that may help others in similar situations. Please hear me out.
Background
My question comes from there being many great distributed filesystems that advertise that they are amazing, but I suspect not all of them are what I need.
I have looked at this awesome list for suggestions on what is available and am not sure which one fits my needs.
Use case
The purpose for this server is to keep my data safe and available for general use. I will be using it to store my personal backups, and data stored and used by Nextcloud, Gogs, and anything else I self-host in the future.
What I am looking for
I am looking for a distributed filesystem that:

protects against bit rot
has erasure coding (or at least data duplication so drive failure doesn't disrupt usage)
ability to scale

from 1 server to more later
from 2 HDDs to more later

can connect via fuse

Powerful API and ease of use are big plusses.
My current hardware
This may not be important, but it may help with tips on implementation.
I currently have a Raspberry  Pi, one 2 TB HDD and one 4 TB HDD. I plan to add one more 2 TB HDD in the near future, and more servers with many more HDDs in the far future (money is tight right now; am poor college student).
My currently proposed solution
I have researched this a lot, and I get this is a little over my head, but here's what I've got so far:
I'm thinking that Ceph is currently my best bet when it comes to flexibility and it seems stable.
My plan would be to to put BTRFS on the drives to handle bit rot, and then run Ceph as a single node cluster for later expansion.
Questions about how this would work
Some specific questions I have about my proposed setup:

I know that BTRFS can have bit rot protection, but is that by default? What do I need for it to be enabled?
I know that the inconsistency in drive size can be a problem (one 2 TB, one 4 TB), but will it work until I get another 2 TB drive?

Thanks
I really appreciate you reading this far :)
Answer: In the last few months I think I've discovered enough to answer this question.
First, the Raspberry Pi only lasted so long, eventually I upgraded to a real computer with great specs. I decided that I only had two options for what I needed, BTRFS and Ceph.
BTRFS
This is the best option for a single node with multiple disks. Upgrading to Ceph later for it's distributed capabilities is not too hard, and getting BTRFS working is very easy.
Some reasons that it's great:

Automatic protection from silent bitrot. If there is a checksum error it will throw an error.
Automatic bitrot healing in Raid 1. It will detect the error, and overwrite any erroneos data with correct data from another disk in the raid 1 array.
Handling BTRFS live is very easy. The command line utils are great.
Can handle different sized disks, but sometimes results in unused space.

Ceph

Can distribute amongst nodes.
Also has bitrot protection with it's BlueStore.
Can take a lot of ram and processing power compared to others. Probably because of the great feature set.

What I decided to do
Since I still only have a single node, I have a BTRFS raid 1 array with one 2 TB SSD and two 1 TB SSDs. This is working great, and adding the 2 TB SSD later was easy.
I plan to switch to Ceph once I have more servers and it makes more sense to. Moving the data shouldn't be too hard then. The only issue is having enough available storage to move it from one place to another.


map to different document roots with single IP address in Apache2

Question: I have a situation where I need to serve multiple websites from the same IP address for testing purposes with Apache. I need to set the sites up as follows:
<code>  126.96.36.199/site1    ->    site1_folder
  188.8.131.52/site2    ->    site2_folder
  188.8.131.52/site3    ->    site3_folder
</code>
In other words, I want to append a folder name (or append something) to the IP address and map this to a document root. How can I set something like this up in Apache? Also, is it possible to set it up to automatically map to certain folders so I don't have to add directives for each documentRoot?
Answer: You will need to use vhosts ( virtual hosts )
There are very simple how-tos on the internet..
READ THIS.... :D
http://www.serverwatch.com/tutorials/article.php/1127571/Apache-Guide-Setting-Up-Virtual-Hosts.htm


Finding an angle expression in terms of argument and complex numbers

Question: Suppose I have an arbitrary triangle, $ADC$, oriented in a clockwise fashion. Using complex numbers $a$, $d$ and $c$, we represent the vertices $A$, $D$ and $C$ respectively.
My question is: If I would like to find the angle $ADC$ in terms of  $\arg(.)$ and $a$, $d$ and $c$, how can I write them?
My guess is: $\angle ADC=\arg(d-c)-\arg (d-a)=\arg \bigg(\dfrac{d-c}{d-a} \bigg)$.
If I am wrong, what should it be then? Also, can someone kindly help me to understand the problem geometrically? My apologies if the question is trivial but I am having a really hard time trying to visualise how to set up the problem. Thank you in advance.
Answer: Yes it is right, we are using the basic properties of complex numbers. Just recall to assume $\arg$ defined in a proper interval as $[0,2\pi)$.
In order to visualize better let consider $D$ as the origin then we obtain
$$\angle ADC=\arg(c')-\arg(a')=\arg(c'/a')=\arg \bigg(\dfrac{c-d}{a-d} \bigg)$$
Comment: Hi @gimusi, by setting $D$ as the origin as you mentioned, the problem became a whole lot easier to see! Thank you!
Comment: Yes indeed! Well done, you are welcome, Bye.


Alterar diretório padrão de consulta padrão (específica) em ADVPL

Question: Estou tentando criar uma consulta padrão específica onde quando o usuário abrir a consulta o caminho já esteja preenchido com um diretório específico definido por mim. Hoje quando ele abre o diretório sempre é "SERVIDOR\", como pode ser visto na figura abaixo

Eu gostaria de conseguir selecionar um diretório específico a ser aberto por exemplo: "SERVIDOR\PASTA1\PASTA2"
O nome da consulta padrão que estou usando agora é "DIR". Nele os valores estão assim:

Tabela: SX5=Tabelas
Expressão: AdmPath()
Retorno: AdmArq()

Alguem saberia como ajudar? Muito Obrigado.
Answer: Você vai precisar criar um fonte customizado:
<code>#include "Protheus.ch"
Static _REResult

User function REFileAdm()
Local cDirInicial := "\PASTA1\PASTA"
Local cMascara := "*.doc"
_REResult :=  cGetFile(cMascara,"Escolha um Arquivo,,cDirInicial)
Return !Empty(_REResult)

User function REFileRet()
Return _REResult
</code>
Compilado este RdMake, Crie uma Consulta Padra Especifica (Consulta RE).


Bitcoind testnet mode No block source available 0 connection

Question: In fact I know this question is hard to answer as it has many reasons for, but is there any clear way to check in "steps" how to configure or know why such a behavior happen and what is the other available solutions?
Comment: Call `bitcoind -debug=net -printtoconsole` and update your question with (all) the output you get up to the point it gets stuck.
Answer: First, download the wallet, open it up and run it.
    Next, click on the bottom left windows symbol and in the search bar type %appdata% (include the percent signs) and hit enter OR click on the Roaming folder
    Find the name of the wallet/coin that you just downloaded and open up the file
    Right click in a vacant spot and choose "New" then choose "Text Document" and open up a blank document.
    Now you make your conf file. (I keep a generic one on hand and just copy and paste... add in any addnodes if they are supplied) Should look something like this:
    rpcuser=miner            Can be any name or letter(s) or number you want, just make sure it matches your batch file
    rpcpassword=x                       Can be any name or letter(s) or number you want, just make sure it matches your batch file
    rpcallowip=127.0.0.1              Local address to mine off your own computer
    rpcport=21213                       Pretty much any port number (I just use the same port for what ever coin I mine unless I must use a different one).
    daemon=1
    gen=0
    listen=1
    addnode=if they give you one put it here
    Save the file as coinname.conf
    Now it gets a little tricky here. It may save the file as coinname.conf.txt and that will NOT work. If it saves it with .TXT at the end, just right click on the file, choose  rename and delete the .txt (make sure you delete the .  (dot) as well as the TXT)
    Now you should be finished there and can close up that file, You can also close the wallet because if it needed an addnode, it has NOT synced up yet anyways.
The wallet should now be set up. The next time you open it, it should sync if it needed an addnode and it should be ready for solo mining because of the conf file you made.
Now we need to set up your miner (I use CGminer... so I am going to go with that).
So to set up the CGminer I make a batch file by going into the CGminer folder and right clicking on a blank space (after you made the first one you can just copy and rename the next ones but we are not there yet). and select New and then select Text Document to open a blank document.
Now you type in your information that you want, should look something like this:
cgminer.exe --scrypt -o http:// 127.0.0.1:21213 -u Miner -p x
Notice the address (-o http:// 127.0.0.1:21213) is the same as the rpcallowip and rpcport numbers in our config file.
Also notice that the user name (-u Miner) and the password (-p x) are the same as the ones we put in our config file as well. (please note that the -u indicates user name and the -p indicates password and are NEEDED in your batch file.
Ok, so now you made your batch file... you just need to save it and rename it to Coin name.bat (dot BAT) and that makes it a batch file.
Once you are done there... it should be that all you need to do is click the batch file, and it will automatically open your miner with the settings you put in, (in this case, its set up to solo mine off your own computer)
Bitcoin node list
See all the file name extension
Comment: This works with any type of cryptocoin and all the algorithms!!


Spam control via email?

Question: My site sends a confirmation email on sign up. There is also a captcha on the signup page. I was thinking... gmail, hotmail and maybe yahoo has captchas on their signup page? In that case should i ignore the captchas on my page since i know spambots cant use gmail/hotmail to confirm the email?
Answer: You should not ignore captchas because email providers use them. Not all of them do.
However, you should try to avoid captchas. If you can prevent spamming and stuff without using captchas, you will better off. However, this might not always be possible- but sometimes it is, and then, IMHO, then totally worth the effort.
Answer: I have captcha on several of my sites, and I still get spam sign-ups using google, yahoo, or other accounts.  It turns out spammers are rather dedicated to bypassing tricks high-volume sites use, but not so much in small sites like mine.
Thus, while you can choose to put all your eggs in someone else's basket, I'd keep those checks local as well.
There are many forms of captcha, and I actually quite like the one used on cricket mobile's site, where a 3x3 array of images is presented, and the user is asked to "click on all the hearts" or "click on all the diamonds."
Comment: What did you think of recaptcha? have you tried that?
Comment: recaptcha is what I use right now.  I like it overall, and it's a great idea and system.  Reliable, etc.  However...  it still requires me to depend upon another system for mine to work properly, it is more difficult to test when not connected to the network (development is what i do), etc.  That said, I'd recommend it over a home-grown system in general.
Answer: Security should be as un-intrusive as possible. IMHO CAPTCHA is an awful 'security' measure that just moves a problem from the site owner, onto the site's users - not good/nice/clever. There are far better ways to stop and block the bad guys these days.

Spam control via email?


How can i display the list of grades of 4 students while rounding them up using Python 3.6

Question: n = int(input("please type number of students and their grades>>>"))
grades = []

def solve_for(grades):
    for i in grades(4):
        if grades_item >= 38:
            if grades_item % 5 == 3:
                grades_item += 2
            elif grades_item % 5 == 4:
                grades_item += 1
        else:
            print(grades_item)

for i in range(n):
    grades_item = int(input())
    grades.append(grades_item)

result = solve_for(grades)

am I doing something wrong?
Trying to get user to input 4 numbers 73, 67, 38, 33 and produce a list that rounds those number based on the if function for-loop
The rules include:

If the difference between the grade and the next multiple of 5 is less than 3, round grade up to next multiple of 5
If the value of grade is less than 38,  no rounding occurs as the result will still be a failing grade.
Comment: "*Unable to run*"  please show what happens, including any error messages.
Comment: There are at least 3 different problems in this code, and fixing them all is beyond the scope of SO. We need you to ask a specific question about your code, otherwise your question is too broad.
Comment: Please confirm that the indentation is correct now after my edit. I *think* this is what your code really looks like, but of course I could be wrong.
Comment: What exactly is wrong with the code you posted? Does it throw an exception? Does it produce incorrect output?
Comment: _"Unable to run"_ should be a particular error and consequently question
Comment: @Aran-Fey Thank you for the edit, it was initially like this but I get
SyntaxError: multiple statements found while compiling a single statement after running that.
Comment: Sounds easily googleable. According to [SyntaxError: multiple statements found while compiling a single statement](//stackoverflow.com/q/21226808) that would happen if you paste this code into an interactive session.
Answer: I posted two fixes next to the two comments. Why did you have the 4 in grades(4) though?
**Sorry, couldn't post the question as a comment as I don't have enough reputation.
n = int(input("please type number of students and their grades>>>"))
grades = []

def solve_for(grades):
    for i in grades: # Grades is not callable as it is a list
        if grades_item >= 38:
            if grades_item % 5 == 3:
                grades_item += 2
            elif grades_item % 5 == 4:
                grades_item += 1
            print(grades_item) # to print it after your edits?
        else:
            print(grades_item)

for i in range(n):
    grades_item = int(input())
    grades.append(grades_item)

result = solve_for(grades)


Rails validates_uniqueness_of error message not working

Question: Respected ppl ...
I have many models, one example is as below  :
class State < ActiveRecord::Base
  attr_accessible :state_name
  belongs_to :location
  validates_uniqueness_of(:state_name)
  validates_presence_of(:state_name)
end

i want to add error message globally for the uniqueness of attributes ...
en:
   hello: "Hello world"
   errors:
     messages:
          taken: "अद्वितीय होना चाहिए/Data Already Exists"
          blank: "रिक्त नहीं किया जा सकता है/can't be blank"

The one for blank is working perfectly but the taken is still not working & i still get the default "has already been taken" error message ...
Kindly help ...
Sincere Regards
-Sky
Comment: I suggest restarting your server - that code looks OK and sometimes I get strangeness with translations that only gets resolved by restarting the server, even in dev mode.
Comment: got it solved ...

I replaced my en.yml file with the one provided here : https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en.yml

and replaced the blank and taken from this file as suited by me ...

Everything is working now :D ....

Regards -Sky
Comment: Thnx sevenseacat :D ... even that works too !!!! .... holyness :D ...
Answer: got it solved ... I replaced my en.yml file with the one provided here : raw.github.com/svenfuchs/rails-i18n/master/rails/locale/en.yml and replaced the "blank" and "taken" from this file as suited by me ... Everything is working now :D ....
Regards -Sky


How can I send keys into a search-box element in Selenium-Java?

Question: This is the method I'm using for sending keys and it's in my parent class:
public void sendKeysFunction(WebElement element, String value) {
        waitUntilVisible(element);
        scrollTElement(element);
        element.clear();
        element.sendKeys(value); }

And this is the way I'm calling it:
dc.sendKeysFunction(dc.BrandNameInput(),"bla bla");

My locators are in the dialog content class and I created a new object as dc so I'm calling my element from dialog content and the methods from parent class.
It's working on usual elements but there is a search-box for bringing the options when you type 3 letters. You can manually type all of the text also. But I cannot sending keys to this element with my test automation framework. It's clicking the element but not sending letters. I tried to use different solutions like Keys.ENTER but it didn't worked. I am sure of my locator. What should I do?
I am expecting to be able to send keys to my elements.
Answer: First of all check or change the element tag with which you try to interact. It is possible you have to interact with the ancestor or descender of the current element, or any other. It will be better if you provide, at least, schematically the structure of your element with the closest elements and tags. At least it isn't clear with which element you try to interact - not all HTML elements might be modified with sendKeys method.
Generally, there are several ways to set text into a web element (input), except sendKeys() calling.

JavascriptExecutor using:

JavascriptExecutor jsExecutor = (JavascriptExecutor) getDriver();
jsExecutor.executeScript("arguments[0].value = arguments[1];", element, "YOUR TEXT");

For example, if input tag has the value attribute you can try to set the value of this attribute:

WebElement element = ...
String script = "arguments[0].setAttribute(arguments[1], arguments[2]);";
jsExecutor.executeScript(script, element, "value", "YOUR TEXT");

Using Action library:

Actions actions = new Actions(getDriver());
actions.sendKeys(element, "YOUR TEXT").perform();

Comment: 3. suggestion worked well. I defined action class wrong. Thank you so much.  I have another issue. I would be appreciated if you can answer. As you can see in my code block above, I implement the scroll down into the send keys method. But It's now scrolling to the element. How can I do this in different ways? Thank you so much from now.
Comment: @HasanEbrarAlarçin Sorry, but I am not sure I understand correctly. If you don't need scrolling just delete the method `scrollTElement(element);`. Or create a new one that doesn't make scrolling. In general, this method violates the SRP and has too many responsibilities. At least the `scrollTElement(element);` should be deleted and called in the cases where this feature is needed.
Comment: If the answer helped solve the issue, please mark it as the right answer.


Failed prop type: You provided a `value` prop to a form field. React-Bootstrap-Typehead

Question: I am using the bootstrap-typehead:https://github.com/ericgio/react-bootstrap-typeahead and I cannot figure out why this package is freaking out. Whats wrong with this code that it gives me this error:
Failed prop type: You provided a value prop to a form field without an onChange handler. This will render a read-only field. If the field should be mutable use defaultValue. Otherwise, set either onChange or readOnly.
import React, { Component } from "react";
import Dropdown from "../../bootstrap/Dropdown";
import RealmAPIs from "../../../API/realms/RealmAPI";

import {Typeahead} from 'react-bootstrap-typeahead';

import AutoComplete from "../../bootstrap/AutoComplete";
// import RealmAPI from '../../../API/realms/RealmAPI';

var options = [
  'John',
  'Miles',
  'Charles',
  'Herbie',
];

export default class FindCharacter extends Component {
  state = {
    realmName: "",
    characterName: "",
    realms: []
  };

  setRealmName = value => {
    this.setState({ realmName: value });
  };

  componentDidMount() {
    // let realms = [...this.state.realms];
    // RealmAPIs.getAllRealms().then(response =>
    //   console.log(response.realms.map(value => {}))
    // );
  }

  render() {
    return (

        <form className="form-inline justify-content-md-center">

            {/* <Dropdown setRealmName={this.setRealmName}/> */}
            <Typeahead
              labelKey="name"
            placeholder="Type a realm"
              onChange={selected => {
                console.log(selected);
              }}
              options={
                options
              }
            />

            <input
              type="text"
              className="form-control"
              id="characterName"
              placeholder="Enter Character Name"
            />

          <button
            type="submit"
            className="btn btn-primary mb-2"
            onClick={e => {
              e.preventDefault();
              console.log(this.state.name);
            }}
          >
            Submit
          </button>
        </form>

    );
  }
}

Comment: Check this out: https://stackoverflow.com/a/43556671/2630817
Comment: Hey so i actually saw this but I tried throwing in an onchange to my input filed, I tried onChange, im not sure how to apply it to my current situation.
Comment: You should have one local state, every onchange is subject to change the state, and rerender the input. so, you will have the updated state with input changes every time
Comment: So typehead has the Onchange in it. So when I remove typehead from the render the warning goes away.
Answer: Upgrading to v3.2.3 of react-bootstrap-typeahead should solve the issue.
I'm not sure why, but React v16.5 (I think?) started triggering the warning. There was an issue tracking it as well as a PR fixing it.


Executar script python ao clicar em botão html

Question: Preciso  alimentar uma pagina html que irá carregar e mostrar o conteúdo de forma dinâmica com ajax/fetch. O problema é que preciso pegar esses dados de outro sites que também carregam esse conteúdo através de ajax, então não posso fazer as requisições para estas paginas com ajax porque elas me retornaram apenas o html basico sem as informações que eu preciso.
A solução que encontrei foi fazer o web scraping com python(selenium) e passar os dados para minha pagina, porém não consigo uma forma de executar meu script python de forma que eu não tenha que usar django(e alterar todo meu projeto) ou escrever arquivos que fiquem sendo lidos constantemente pelo python e congestione os acessos. Vi também algumas coisas relacionadas a CGI, mas me parece não ser o que estou procurando pois mostra os elementos dando print nas tags, porém preciso carregar de forma dinâmica, alem de preferir receber esses dados como json, xml ...
Há alguma forma de executar um script python semelhante um script php que é chamado na tag <form>?
OBS: soluções alternativas podem ajudar mas a principio queria algo com essas ferramentas ou dessa forma.
Comment: Não há necessidade de migrar tudo para o Django. Você pode usar um framework leve como o [Flask](https://flask.palletsprojects.com/en/1.1.x/quickstart/).
Answer: Eu não manjo de python, mas para chamar uma página no backend sem necessariamente acessar ela de forma visível, seria fazendo uma requisição assíncrona, através do AJAX.
Não entendi muito bem a sua necessidade, mas vamos supor que você queira um formulário dinâmico, de acordo com algum retorno, regra, etc... no backend, você pode obter essa informação de uma forma bem fácil acessando essa página com ajax:
var xhr = new XMLHttpRequest();

xhr.open("GET", 'sua_pagina'); // envia a requisição a url
xhr.send(null);

xhr.onreadystatechange = function() { // chama uma função quando o documento for carregado
    if(xhr.readyState === 4) { // verifica se a resposta foi de sucesso
        document.querySelector('form').innerHTML = xhr.responseText // exibe a resposta no seu formulario
    }
}

E você pode ter html puro vindo do seu backend, que vai funcionar e exibir no seu formulário tranquilamente.
Vale lembrar que essa forma de fazer requisições ajax é bem antiga, hoje em dia existem meios mais fáceis e modernos, se você tiver a liberdade, dê uma olhada:

Fetch

jQuery

Usando jQuery por exemplo, você reduz isso tudo pra uma linha se simplesmente só quiser carregar os dados:
$('form').load('sua_pagina');

Espero ter ajudado!!


Erro ao ler CSV: A non well formed numeric value encountered

Question: Estou tentando pegar 3 valores diferentes de 3 arquivo csv distintos e multiplicá-los, mas está dando este erro. Onde errei? Ou o que falta acrescentar?!
Erro:

Notice: A non well formed numeric value encountered in C:\xampp\htdocs\Acessando arquivos CSV\fgetcsv.php on line 34
Notice: A non well formed numeric value encountered in C:\xampp\htdocs\Acessando arquivos CSV\fgetcsv.php on line 34

Código:
<?php
$file1 = __DIR__ . '/Trabalhos.csv';
$csv1 = file($file1);
foreach ($csv1 as $row1 => $line1) {
    $row1++;
    $column1 = str_getcsv($line1, ';');
    if ($row1 == 2) {
        echo $column1[6]."
";
        $valor1 = $column1[6];
    }
}

$file2 = __DIR__ . '/produtividade do trabalho.csv';
$csv2 = file($file2);
foreach ($csv2 as $row2 => $line2) {
    $row2++;
    $column2 = str_getcsv($line2, ';');
    if ($row2 == 2) {
        echo $column2[9]."
";
        $valor2 = $column2[9];
    }
}
$file3 = __DIR__ . '/inatividade do trabalho.csv';
$csv3 = file($file3);
foreach ($csv3 as $row3 => $line3) {
    $row3++;
    $column3 = str_getcsv($line3, ';');
    if ($row3 == 2) {
        echo $column3[0]."
";
        $valor3 = $column3[0];
    }
}

$total = $valor1 * $valor2 * $valor3

?>

Comment: Copia o erro ao invés de postar foto.
Comment: Perdão. Vou colocar.
Comment: Testei o teu PHP e esta perfeito, o problema é no CSV.
Answer: O problema é no conteúdo de um dos CSVs, não tem como saber, mas o problema é que ao pegar o valor como em:
 echo $column2[9]."
";

Deve estar pegando o item errado em um deles, então ao tentar multiplicar:
 $total = $valor1 * $valor2 * $valor3;

Deve estar ocasionando o erro, veja se fizer isto irá obter o erro:
<?php

$valor1 = 'foo';
$valor2 = '2';
$valor3 = '3';

$total = $valor1 * $valor2 * $valor3;

Ou seja a mensagem indica que você esta tentando fazer uma operação matemática sem ter um numero valido:

Notice: A non well formed numeric value encountered

É importante entender que formatos com , em números não são considerados números para operações matemáticas, então se receber algo como:

1.074,00

Isto não será um numero "valido", então basta tratar, segue o código revisado (para simplificar e evitar repetição de códigos movi para uma função)
<?php

function pegar_valor_coluna($arquivo, $getrow, $getcol)
{
    $csv = file($arquivo);
    $row = 0;

    foreach ($csv as $row => $line) {
        $row++;

        if ($row == $getrow) {
            $column = str_getcsv($line, ';');
            $valor = $column[$getcol];

            //Conversão para números simples

            //Conversão para números simples
            $valor = str_replace(array('.', ' '), '', $valor);
            $valor = str_replace(',', '', $valor);

            return $valor;
        }
    }
}

$valor1 = pegar_valor_coluna(__DIR__ . '/Trabalhos.csv', 2, 6);
$valor2 = pegar_valor_coluna(__DIR__ . '/produtividade do trabalho.csv', 2, 9);
$valor3 = pegar_valor_coluna(__DIR__ . '/inatividade do trabalho.csv', 2, 0);

$total = $valor1 * $valor2 * $valor3;

Comment: Sim, deu o mesmo erro. Ai alteirei o "foo" para "1" e fez a multiplicação perfeitamente. Então, o que devo fazer?! Porque são esses valores
1.074,00
60,00
2091832

que ele pega dos arquivos csv. Será que não está aceitando por causa das vírgulas e pontos?!
Comment: Opa, espera. O erro que dá é esse aqui: Warning: A non-numeric value encountered in, não é o mesmo. Perdão.
Comment: @Alex_Alex_Alex em MAQUINA valores como espaços e virgulas **não** são valores numericos, para operações matematicas somente INT e Float são funcionais.
Comment: Então vou transformar os valores em float, entendi. Vai resolver meu problema. Obrigado Guilherme!
Comment: @Alex_Alex_Alex eu adicionei um exemplo para converter para numero na resposta, testa ela por favor, tinha um bug no exemplo anterior


Blown save when starter is ineligible for a win

Question: I'm parsing some baseball data, so I need to be able to appropriately award saves, blown saves, holds, etc. In doing so, I came across some examples that I'm unsure how to handle.
Example 1: Suppose Adam is the starter and he leaves the game after 4 innings and his team is leading by a run. Billy comes in and pitches into the 8th, when he gives up the tying run. Is Billy charged with a blown save?
Example 2: Suppose pitcher Adam is the starter and he leaves the game after 4 innings and his team is leading by a run. Billy comes in and pitches a scoreless 5th and 6th. The score is unchanged when Charlie comes in in the 7th, and allows the tying run. Is Charlie charged with a blown save?
Example 3: Suppose pitcher Adam is the starter and he leaves the game after 4 innings and his team is leading by a run. Billy comes in and pitches a scoreless 5th. The score is unchanged when Charlie comes in in the 6th, and he pitches a scoreless 6th, 7th, and 8th. It is still a 1 run game when David comes in in the 9th, and records a scoreless 9th. Could the official scorer determine that Charlie deserves the win (hence David gets a save), while Billy gets a hold?
My intuition: 1) No, because there is no other pitcher eligible to receive the win. Hence, it's not truly a save situation, and Billy can't be charged with a blown save. 2) Yes, because Billy could be assigned the win, thus Charlie would have entered in a save situation. Therefore, he would be charged with a blown save. 3) No, it doesn't make any sense for a pitcher to get a hold and the pitcher that relieves him gets a win when their team does not surrender their lead.
Answer: All rules related with Win-loss record (pitching), Save (baseball) and Hold (baseball) are well-explained in the links. Your questions seem to be focused on save situations.

No. In order for a pitcher to be credited with a save or charged with a blown save, there should be a save situation (opportunity). Since there is none, Billy will not be charged with a blown save.
Yes.
Yes or no.  If Charlie was the most effective relief pitcher in the official scorer's judgment, he could be awarded a win. Also, you need to note that David can't get a hold because there was no save situation.

A save is a statistic credited to a
  relief pitcher, as set forth in Rule 10.19 of the Official Rules of
  Major League Baseball. That rule states the official scorer shall
  credit a pitcher with a save when such pitcher meets all four of the
  following conditions:

He is the finishing pitcher in a game won by his team;
He is not the winning pitcher;
He is credited with at least 1/3 of an inning pitched; and He satisfies one of the following conditions:
(1) He enters the game with a lead of no more than three runs and pitches for at least one inning
(2) He enters the game, regardless of the count, with the potential tying run either on base, at bat or on deck
(3) He pitches for at least three innings.

If a relief pitcher satisfies all of the criteria for a save, except he does not finish
  the game, he will often be credited with a hold (which is not an
  officially recognized statistic by Major League Baseball).
Comment: In your answer, under E1, I assume you mean Billy? And my instinct (no one else can get a win implies that a save situation doesn't exist) is correct? Similarly, in E3, David would get a save by virtue of closing the game (assuming he's not named the winner). I fail to see how E2 and E3 could be "yes or no, it depends" type of answers. I would expect them to be one or the other. If in E1 Billy cannot be charged with a blown save, because there was no one else eligible for a win, then I would expect that in E2 Charlie would be charged with a blown save, because Billy could get the win.
Comment: @PistolPete I edited my answer.
Comment: thanks for clearing up the confusion. Additionally, my reasoning that I gave at the end of my initial post is correct?


How can I solve linear equation AX=b for sparse matrix

Question: I have sparse matrix A(120,000*120,000) and a vector b(120,000) and I would like to solve the linear system AX=b using Eigen library. I tried to follow the documentation but I always have an error. I also tried change the matrix to dense and solve the system
<code>    Eigen::MatrixXd H(N,N);
    HH =Eigen:: MatrixXd(A);
    Eigen::ColPivHouseholderQR<Eigen::MatrixXd> dec(H);
    Eigen::VectorXd RR = dec.solve(b);
</code>
but I got a memory error.
Please help me find the way to solve this problem.
Answer: For sparse systems, we generally use iterative methods. One reason is that direct solvers like LU, QR... factorizations fill your initial matrix (fill in the sense that initially zero components are replaced with nonzero ones). In most of the cases the resulting dense matrix can not fit into the memory anymore (-> your  memory error). In short, iterative solvers do not change your sparsity pattern as they only involve matrix-vector products (no filling).
That said, you must first know if your system is symmetric positive definite (aka SPD) in such case you can use the conjugate gradient method. Otherwise you must use methods for unsymmetric systems like BiCGSTAB or GMRES.
You must know that most of the time we use a preconditioner, especially if your system is ill-conditioned.
Looking at Eigen doc I found(example without preconditioner afaik):
<code>  int n = 10000;
  VectorXd x(n), b(n);
  SparseMatrix<double> A(n,n);
  /* ... fill A and b ... */
  BiCGSTAB<SparseMatrix<double> > solver;
  solver.compute(A);
  x = solver.solve(b);
  std::cout << "#iterations:     " << solver.iterations() << std::endl;
  std::cout << "estimated error: " << solver.error()      << std::endl;
</code>
which is maybe a good start (use Conjugate Gradient Method if your matrix is SPD). Note that here, there is no preconditioner, hence convergence will be certainly rather slow.
Recap: big matrix -> iterative method + preconditioner.
This is really a first "basic/naive" explanation, you can found futher information about the theory in Saad's book: Iterative Methods for Sparse Linear Systems. Again this topic is huge you can found plenty of other books on this subject.
I am not an Eigen user, however there are precondtioners here.
-> Incomplete LU (unsymmetric systems) or Incomplete Cholesky (SPD systems) are generally good all purpose preconditioners, there are the firsts to test.


How to control CSS arrow size

Question: I created an arrow in CSS. Everything is working as it should except the size of the arrow. I am not sure how I can make it smaller.
How can I make the arrow smaller?

#blue {
  width: 100%;
  height: 100vh;
  background: blue;
}
#box2 {
 position: absolute;
 top: 25%;
 right: 25%;
 z-index: 1;
}
#box2Text {
 color: #FFF;
 font-family: 'Muli', sans-serif;
 font-size: 2rem;
 font-weight: 300;
 line-height: 1.4em;
 padding: 80px;
 border: 6px solid #FFF;
 border-radius: 2px;
 display: block;
 text-align: center;
}
#arrow {
 margin-top: 10px;
 border: solid #FFF;
    border-width: 0 3px 3px 0;
    display: block;
    padding: 3px;
 transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
}

    View Services

Desired output:
Comment: When width and height are applied the arrows falls outside of the border (box).
Comment: can you show the desired output ?
Comment: @TemaniAfif See the illustration in my modified question. After adding the width and height the arrow is now positioning itself outside of the box. I am wanting it in the box where I put the x.
Answer: Use the arrow as a pseudo element of the text div and you can easily place it and adjust its size:

#blue {
  width: 100%;
  height: 100vh;
  background: blue;
}

#box2 {
  position: absolute;
  top: 25%;
  right: 25%;
  z-index: 1;
}

#box2Text {
  color: #FFF;
  font-family: 'Muli', sans-serif;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1.4em;
  padding: 80px;
  border: 6px solid #FFF;
  border-radius: 2px;
  display: block;
  text-align: center;
  position:relative;
}
#box2Text:after {
  content:"";
  left:calc(50% - 5px);
  margin-top:40px;
  position:absolute;
  border: solid #FFF;
  border-width: 0 3px 3px 0;
  width:10px;
  height:10px;
  transform: rotate(45deg);
}

    View Services

Comment: This is perfect. Thanks for the help!
Answer: You just need to specify CSS width and height attributes to #arrow. you might need to adjust the arrow position after that according to your needs

#blue {
  width: 100%;
  height: 100vh;
  background: blue;
}
#box2 {
 position: absolute;
 top: 25%;
 right: 25%;
 z-index: 1;
}
#box2Text {
 color: #FFF;
 font-family: 'Muli', sans-serif;
 font-size: 2rem;
 font-weight: 300;
 line-height: 1.4em;
 padding: 80px;
 border: 6px solid #FFF;
 border-radius: 2px;
 display: block;
 text-align: center;
}
#arrow {
 margin-top: 10px;
 border: solid #FFF;
    border-width: 0 3px 3px 0;
    display: block;
    padding: 3px;
 transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    width: 5px;
    height: 5px;
}

    View Services

Comment: When I add this for some reason the arrow falls outside of the box.
Comment: @Paul it was always outside of the box but when you rotated it 45 degrees around its center while having 100% width half of it entered the box while the other half stayed out. that's why you need to further position the arrow where you want it to be
Answer: Like this?

#blue {
  width: 100%;
  height: 100vh;
  background: blue;
}
#box2 {
 position: absolute;
 top: 25%;
 right: 25%;
 z-index: 1;
}
#box2Text {
 color: #FFF;
 font-family: 'Muli', sans-serif;
 font-size: 2rem;
 font-weight: 300;
 line-height: 1.4em;
 padding: 80px;
 border: 6px solid #FFF;
 border-radius: 2px;
 display: block;
 text-align: center;
}
#arrow {
    margin-right:15px;
    margin-bottom:5px;
 border: solid #FFF;
    border-width: 0 3px 3px 0;
    display: inline-block;
    padding: 3px;
 transform: rotate(-45deg);
    -webkit-transform: rotate(-45deg);
    width: 5px;
    height: 5px;
}

View Services

Comment: No. The arrow is in its correct form. Whenever I apply width and height to the arrow the position of it change.s
Comment: Of coure beacuse it isn't a real arrow icon , they are 2 sides border white of a little box  thant you rotated, so you need to adjust the margins when you increase the size

How to control CSS arrow size