If statements in shaders - implications and consequences
Is a constant condition more costly than switching shaders?
Brand new laptop, two years in storage, will the battery be ok? I have an opportunity to buy a brand new (sealed box) EliteBook 8470p laptop for a good price.  The date of manufacture goes back to around March 2013, which is bang on two years ago.  Given that it's been two years, what state will the supplied Lithium-Ion battery be in? Still usable? Sorting an Array of Objects in PHP In a Specific Order I have two arrays in PHP. The first array ($author_array) is comprised of user_ids in a particular order, like so: (8, 1, 6)  The second array ($user_results) is comprised of an array of objects like so:  Array (     [0] =&gt; stdClass Object         (             [ID] =&gt; 1             [user_login] =&gt; user1         )     [1] =&gt; stdClass Object         (             [ID] =&gt; 6             [user_login] =&gt; user6         )     [2] =&gt; stdClass Object         (             [ID] =&gt; 8             [user_login] =&gt; user8         ) )   I'd like to "sort" the second array so it's in this order, which matches the order of the values in the first array of (8, 1, 6). So it'd look like this:  Array (     [0] =&gt; stdClass Object         (             [ID] =&gt; 8             [user_login] =&gt; user8         )     [1] =&gt; stdClass Object         (             [ID] =&gt; 1             [user_login] =&gt; user1         )     [2] =&gt; stdClass Object         (             [ID] =&gt; 6             [user_login] =&gt; user6         ) )   I'm weak on data structures. How could I do this? :-)  Thanks in advance for your help!  -Bob I just noticed that I lost a bunch of points from my reputation score, and I used the "reputation" tab on my user profile page to try and track down the cause.  During my investigation, I noticed there was an unusual event of type "reversal". In the normal place of a question title, it says "voting corrected".     What does this mean, and what caused it?  Did I do something wrong? Why did I lose all of that reputation? Is the system punishing me for leaving too many good answers?  Is there any way to earn it back? Java rounding to nearest 0.05 Create an interface which is similar to the material list box There seems to be some bug where mac os is constantly contacting . You can prevent it by turning off the wifi, but then your computer is nothing more than a fancy calculator. Is there a program, vpn, or even the firewall option, to block this site from the whole os? Exact Sequences of Modules and Rank Suppose that:  $0 \rightarrow M_{1} \rightarrow M \rightarrow M_{2} \rightarrow 0$  Is an exact sequence of $R$-modules (for $R$ commutative integral domain). Show that $\mathrm{rk}(M) = \mathrm{rk}(M_{1})+\mathrm{rk}(M_{2})$    I have shown the inequality $\mathrm{rk}(M) \geq \mathrm{rk}(M_{1})+\mathrm{rk}(M_{2})$, however for the opposite direction I'm lost. I tried to take $N$ as a linear independent subset and tried to decompose it into $N_{1}$ (the elements in $\mathrm{Ker}(g)$) and $N_{2}$ (the elements not in $\mathrm{Ker}(g)$), but I haven't got far, since $N_{1}$ gives us a linearly independent set in $M_{1}$, however $N_{2}$ can give us a linearly dependent set in $M_{2}$.   We define $\mathrm{rk}(M)$ in this case as the supremum over all cardinalities of the linearly independent subsets of $M$ (where the only finite linear combination equaling $0$ implies trivial coefficients for $r \in R$).  Would this be the proper way to show the result? I think I'm missing something important. Dirac delta function and volume charge density I just got introduced to the Dirac delta function and one of the questions was to express volume charge density $\rho({\bf r})$ of a point charge $q$ at origin. I saw that the answer is related to Dirac delta function as: $$\rho({\bf r}) = q \delta^3({\bf r})$$ where $\delta^3({\bf r})$ is the 3-dimensional Dirac Delta function. Why is it so? How to create live autofill search? I am currently trying to create a wordpress search function that shows live results underneath the search bar. There is an example on the  website (screens below). I'm not looking for an autofill like you would find on Google.com which completes words you type, rather I want it to find actual posts on the site.   I tried doing a scrub through Wordpress Answers and other similar resources but have only run into implementing a Google type search which is not what I am looking for. Any help or points in the right direction would be greatly appreciated. Just beginning to learn quantum mechanics and my textbook says that all pure eigenstates of the Schrodinger equation ( with a specified potential function) have a zero standard deviation for the expectation values of energy.So every measurement of the energy yields a fixed value. I've also read that pure eigenstates are physically realisable solutions in some situations ( like the infinite potential well). But wouldn't that violate the uncertainty principle? the standard deviation in expectation of energy is zero and hence $$ΔE~Δt=0.$$ Where am I going wrong? Also could someone also give me an insight as to what uncertainty in time even means? I haven't been able to grasp that concept clearly yet. Where can I ask Android related questions in Stack Exchange? I would like to know where I can ask Android apps and other mobile related questions. Is there a Stack Exchange site for such questions? I am looking for system monitoring tools which are GUI and CLI or web-based which include basic functions such as:   CPU Usage Ram Usage Swap Usage Disk Usage ( Space / I/O ) Heat Monitoring   I know there are many tools I can use, but I am looking for a single tool that has these basic functions. How can I serialize an object to JSON without properties that are null? To communicate with a REST interface on a private system, I need to send a JSON message from a trigger. I have a message object that has some fields, lists and a child object:  public class MerchantConfig {  public class MIDConfig {     public String mid;     public String currencyCode;     public String cardTemplateName;     public String paymentPanelRestriction;     public List&lt;String&gt; restrictedCountries;      public String paymentPanelRestrictionForCountries; }  public String merchantName; public String sopgTemplateName; public Integer dispositionTimeWindowInMinutes; public List&lt;String&gt; features; public Boolean activateImmediately; public List&lt;MIDConfig&gt; midConfiguration; }   I can serialize it to JSON using the built-in serializer:  String body = JSON.serializePretty([MerchantConfig instance]);   The result:  {   "sopgTemplateName" : null,   "midConfiguration" : [ {     "restrictionCountries" : [ "DE", "AT" ],     "paymentPanelRestrictionForCountries" : "MANDATORY",     "paymentPanelRestriction" : "OPTIONAL",     "mid" : "1000000001",     "currencyCode" : "EUR",     "cardTemplateName" : null   }, {     "restrictionCountries" : [ ],     "paymentPanelRestrictionForCountries" : "",     "paymentPanelRestriction" : "OPTIONAL",     "mid" : "1000000002",     "currencyCode" : "USD",     "cardTemplateName" : null   }, {     "restrictionCountries" : [ ],     "paymentPanelRestrictionForCountries" : "",     "paymentPanelRestriction" : "PROHIBITED",     "mid" : "1000000003",     "currencyCode" : "AUD",     "cardTemplateName" : null   } ],   "merchantName" : "Test Merchant",   "features" : [ XYZ ],   "dispositionTimeWindowInMinutes" : 10,   "activateImmediately" : true }   How can I serialize this object so that all properties that are null don't show up in the JSON string?   In this example, "sopgTemplateName" and all "cardTemplateName" properties are null and should not appear in the JSON string. The empty list "restrictionCountries" should still appear as an empty list, though. It seems that a common operation needed when defining new commands is to scan over a list of arguments (separated e.g. by a comma, but maybe by something else) and do something with each argument in the list, find the last one, or whatever.  For example to write commands that look like \Command{a,b,c} or \Command{c.d.e} and do something with each a, b, and c. See e.g. questions on  and .  Some solutions have been posted there, but what would be the best idiom to perform such kind of operations? LaTeX's \@for looks very nice, but is it possible to use it to scan anything other than comma-separated lists? Why is the image of a smooth embedding $f: N \to M$ an embedded submanifold? I'm reading An Introduction to Manifolds (Tu) and got confused on p.123 Theorem 11.13. Let me briefly explain what was done before that.  The author defines an embedding between two manifolds $f: N\rightarrow M$ as an injective immersion (differential is injective everywhere) with the additional property that $f(N)$ as a subspace of $M$ is homeomorphic via $f$ to $N$. Then a canonical form theorem is proven, namely, that for any point $p \in N$, there are charts $(U,\phi = x^1, \ldots, x^n) \ni p$ and $(V,\psi = y^1, \ldots, y^m) \ni f(p)$, such that the transition map takes the following form:  $$\psi \circ f \circ \phi^{-1} : (r^1,\ldots,r^n) \mapsto (r^1,\ldots,r^n,0,\ldots,0).$$  (I guess it is implicitly assumed that $f(U) \subset V$).  Now in the process of proving that $f(N) \subset M$ is an , he states that $f(U) \subset V$ is defined by the vanishing of the coordinates $y^{n+1},\ldots,y^m$. I can prove that $$ f(U) \subset \{q \in V: y^{n+1}(q) = \cdots = y^m(q)\} $$ but not the reverse inclusion. Can anyone explain why this should be true? How exactly does curved space-time describe the force of gravity? I understand that people explain (in layman's terms at least) that the presence of mass "warps" space-time geometry, and this causes gravity. I have also of course heard the analogy of a blanket or trampoline bending under an object, which causes other objects to come together, but I always thought this was a hopelessly circular explanation because the blanket only bends because of "real" gravity pulling the object down and then pulling the other objects down the sloped blanket. In other words, to me, it seems that curved space wouldn't have any actual effect on objects unless there's already another force present.   So how is curved space-time itself actually capable of exerting a force (without some source of a fourth-dimensional force)?  I apologize for my ignorance in advance, and a purely mathematical explanation will probably go over my head, but if it's required I'll do my best to understand. If p $\equiv$ 3 (mod 4) with p prime, prove -1 is a non-quadratic residue modulo p. If p $\equiv$ 3 (mod 4) with p prime, prove -1 is a non-quadratic residue modulo p.  I suppose this would not be true if p $\equiv$ 1 (modulo 4).  To prove something is a non-square I find to be tricky. It's difficult to see any straightforward way to do this using only the definition of congruence for example. How do ${0##*/} and ${0%/*} work? I'm quite confused about the following regular expressions I found in a shell script:  ${0##*/} ${0%/*}   How do they work? Why is $\langle \textbf R \rangle =Tr \rho R$ here $\rho$ is the state density matrix Is temperature a Lorentz invariant in relativity?