How do I blit a PNG with some transparency onto a surface in Pygame?
What is a good way to draw images using pygame?
I have 10 years of daily returns data for 28 different currencies. I wish to extract the first principal component, but rather than operate PCA on the whole 10 years, I want to rollapply a 2 year window, because the currencies' behaviours evolve and so I wish to reflect this. However I have a major problem, that is that both the princomp() and prcomp() functions will often jump from positive to negative loadings in adjacent PCA analyses (ie 1 day apart). Have a look at the loading chart for the EUR currency:    Clearly I can't use this because adjacent loadings will jump from positive to negative, so my series which uses them will be erroneous. Now take a look at the absolute value of the EUR currency loading:    The problem is of course that I still cannot use this because you can see from the top chart that the loading does go from negative to positive and back at times, a characteristic which I need to preserve.   Is there any way I can get around this problem? Can I force the eigenvector orientation to always be the same in adjacent PCAs?   By the way this problem also occurs with the FactoMineR PCA() function. The code for the rollapply is here:  rollapply(retmat, windowl, function(x) summary(princomp(x))$loadings[, 1], by.column = FALSE, align = "right") -&gt; princomproll I need to show that for any countable ordinal $\alpha$ there is a set A $\subseteq \mathbb{Q}$ such that (A, &lt;) is isomorphic to ($\alpha, \in$).  To do it I am supposed to show the following stronger statement by induction on ordinals $\alpha$ &lt; $\omega_{1}$:  Let P($\alpha$) be the statement "For every interval (a, b) with rational endpoints, there is an A $\subseteq$ (a,b) such that (A, &lt;) is isomorphic to ($\alpha, \in$)."  I think that the purpose of breaking $\mathbb{Q}$ into intervals (a,b) is to make $\mathbb{Q}$ a countable set, but I don't see the significance of doing this or how it would make the proof easier.  I feel like I need to define a well-ordered set in (a,b) but I don't know how to do this since if a and b are both negative then there is no least element, so no well-ordering.  I believe that I am supposed to be using transfinite induction? But I don't know how P($\alpha$) implies P(S($\alpha$)) for S($\alpha$) successor of $\alpha$.  Any help would be greatly appreciated... thanks in advance. Primitive polynomials I am revising for a discrete mathematics exam and as quite stuck on this question.  Show that the polynomial $f = x^2 + 2 x + 3 \in \mathbb{Z}_5[x]$ is primitive. How many monic primitive quadratic polynomials are there in $\mathbb{Z}_5[x]$?  Any help would be greatly appreciated. Use /testfor to make a custom command Basically, I'm trying to recreate the Faction plugins /f map in my single-player without mods as my PC doesn't run them very well. (I know it sounds strange.) I am trying to use the /testfor to test if I have written '/f map' in chat, and if I have, it would show me a custom generated map. I don't know how to word this better xD Essentially what I want is for it to test if I have written a command in chat, and if I have, display something. When should one use "should" and when should one use "must"? I tend to use should when it's a suggestion I don't have a strong opinion on, i.e. it could be done in many other ways than the one I'm suggesting and it can still happen.     You should stop by that gas station to go to the bathroom.   On the other hand, I usually use must for things that have to happen in a certain way; any other way would make that thing not to happen. The problem is that some people find this usage harsh, as they receive it like if I'm giving them an order.      You must cross the street to get to that store.   To me, it's just a depiction of reality, not an order. But I'm neither a native speaker nor a regular person. :-)  So, what's the proper use for must and should? Does this use differ among the English dialects? Do photons bend spacetime or not? I have read this question:     where Safesphere says in a comment:     Actually, photons themselves don't bend spacetime. Intuitively, this is because photons can't emit gravitons, because, as any massless particles not experiencing time, photons can't decay by emitting anything. The latest theoretical results show that the gravitational field of a photon is not static, but a gravitational wave emanating from the events of the emission and absorption of the photon. Thus the spacetime is bent by the charged particles emitting or absorbing photons, but not by the photons themselves.        where John Rennie says:     as far as I know there has been no experimental evidence that light curves spacetime. We know that if GR is correct it must do, and all the experiments we've done have (so far) confirmed the predictions made by GR, so it seems very likely that light does indeed curve spacetime.   Now this cannot be right. One of them says photons do bend spacetime, since they do have stress-energy, but it is hard to measure it since the energy they carry is little compared to astronomical body's stress-energy. So they do bend spacetime, it is just that it is hard to measure it with our currently available devices.  Now the other one says that photons do not bend spacetime at all. It is only the emitting charge (fermion) that bends spacetime.  Which one is right? Do photons bend spacetime themselves because they do have stress-energy or do they not? How fast is Earth moving through the universe? As the galaxy is moving and the solar system orbiting the galaxy and the Earth orbiting the sun. So how fast is each object moving and what is the fastest we move at?  Do we even know how fast the galaxy is moving that is not relative to another galaxy (although I guess velocity has to be measured relative to something). How do you explain cubic growth of a function When reading scientific papers I have seen people explain the growth of a variable linearly, exponentially. However how would one say for a variable which grows in quadratic fashion, or cubic?  I don't remember reading something like: "y grows cubically with x"  Can I say, y grows cubically with x?  What would be the proper way to explain cubic or quadratic growth of a variable as a function of another one?  How would you explain the given lines: How do I send HTML email using linux 'mail' command? How do I copy to the clipboard in JavaScript? Box around single element in list Is there any way in latex to create a simple box around one item in a list?  I tried both \framebox, and \fbox, none of them worked  \begin{enumerate}[label=\Alph*),ref=\Alph*] {\color{red}\item null.}  \item lik vektdifferansen $GT - GK$. \item lik vektsummen $GT + GK$. \item lik vekten av $K$. \end{enumerate}   Works, but   \begin{enumerate}[label=\Alph*),ref=\Alph*]  {\color{red}  \fbox{ \item null.} }   \item lik vektdifferansen $GT - GK$. \item lik vektsummen $GT + GK$. \item lik vekten av $K$. \end{enumerate}   Does not. So yeah, any way to box a single entry in a list? Elegant way of obtaining the envelope of oscillating function Connect MacBook Pro to two external monitors Is there a way to connect my MacBook Pro to two external monitors (either VGA or HDMI; no Thunderbolt) in such a way that the Mac screen serves as a third monitor?  What hardware do I need? Word for person unwilling to share information What do you call a person who is unwilling to share information? I am working on the following problem asked in an examination: "What is the maximum number of cylindrical pencils of 0.5 cm diameter that can be stood in a square shaped stand of 5cm × 5cm inner cross section? 1. 99    2. 121   3. 100    4. 105." A simple calculation yielded me the answer 100.  But the answer in the key is 105. I don't how such an answer is possible. Any hint please.....Thanks in advance! These questions are really bothering me. Any help would be much appreciated.  Let $p$ be prime  a) If $(G, \oplus)$ has order $2p$, prove that every proper subgroup of $(G, \oplus)$ is cyclic  b) If $(G, \oplus)$ has order $p^2$, prove that $(G, \oplus)$ has a subgroup of order $p$ Where can I get freely available audio, graphics, and other resources for games? Making SSD & HDD work together like a hybrid In my test class i have the creation of a dummy custom setting and a dummy lead:  Group g1 = new Group(Name='group name', type='Queue');              insert g1;             QueuesObject q1 = new QueueSObject(QueueID = g1.id, SobjectType = 'Lead');              insert q1;       SetOwner__c mycs = SetOwner__c.getValues('standardset');               if(mycs == null) {                               mycs = new SetOwner__c(Name= 'CustomValues');                  mycs.OwnerId__c ='00520000000z3PrAAI';                  mycs.RecordtypeID__c='012L00000004QsrIAE';                  insert mycs;      Lead lead = createNewLead(u2.id);                           insert lead;   ERROR:  MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): SetOwner__c, original object: QueueSobject: []   I get this error because i am trying to perform DML on setup and non-setup objects in the same transaction.  Any solution for this problem? I know from reading about the gravitational waves detected by Ligo, that when an object has angular acceleration, it produces gravitational waves.  I'm wondering if an object creates gravitational waves when only accelerating in one direction, however?   I'm also curious as to how the nature of the waves would differ in this case.