I cannot get import random to work- python 3
What's the bad magic number error?
i have a tiny little problem with xslt, js and html entities, eg. within a template:  &lt;script type="text/javascript"&gt;     &lt;xsl:value-of select="/some/node"/&gt;     for (var i = 0; i &amp;lt; 5; i++) {         //            ^^^ js error     } &lt;/script&gt;  &lt;script type="text/javascript"&gt;     &lt;xsl:value-of select="/some/node"/&gt;     for (var i = 0; i &lt; 5; i++) {         //            ^ xslt error     } &lt;/script&gt;  &lt;script type="text/javascript"&gt;     &lt;xsl:value-of select="/some/node"/&gt;     // &lt;![CDATA[     for (var i = 0; i &lt; 5; i++) {         //            ^ becomes &amp;lt;     }     // ]]&gt; &lt;/script&gt;   &lt;script type="text/javascript"&gt;     &lt;xsl:value-of select="/some/node"/&gt;     for (var i = 0; i &lt;xsl:value-of disable-output-escaping="yes" select="string('&amp;lt;')"/&gt; 5; i++) {         // works of course     } &lt;/script&gt;   does anyone have an idea where my problem could come from? i always thought the xslt processor would leave the content of a &lt;script/&gt; element unescaped when using the html output method ...  i run libxslt2 version 1.1.24 on OSX which was installed using macportsports ... I'm studying special relativity and saw the 2 postulates of Einstein. The most remarkable one for me is the universal speed of light. Einstein postulated that the speed of light in vacuum is the same for all inertial observers, regardless of the motion of the source. But what if we are accelerating and we are changing from one inertial frame to another, how will we observe the speed of light? Is it still the same? I suggest it's not? Because I alread saw a small introduction to general relativity where the light will bend in a gravitational field and therefore also when you accelerate. So does the speed of light change because it bends? Disclaimer: I'm pretty novice at sysadmin stuff.  I'm trying to set up port forwarding in an AWS EC2 instance, this has to be done in the command-line because I don't want to go in and edit anything, it has to be automatic (it's part of a build process).   sudo echo "net.ipv4.ip_forward = 1" &gt;&gt; /etc/sysctl.conf      Permission denied   The weird thing is I've been (successfully) using sudo for pretty much every command that required su privileges. If I do sudo su before the command (trying it out by hand in an ssh session), then it works.  Reasons behind this? Possible solutions that don't involve sudo su or manual edits? Can you win a game of Splendor if you still have cards in reserve? Why are rings called rings? Is the 64-Bit version of Ubuntu only compatible with AMD CPUs? I was told that computers with more than 2 gig's memory need a 64 bit operating system to utilize all RAM.  Is the 64bit Ubuntu download really JUST for AMD processors? I am asking because the disk image I downloaded says AMD64.  So will my new Intel 2.3Ghz Core i3 Dual Core processor work with 64 bit Ubuntu?  It runs the 64bit version of Windows without any qualm. Passing list to viewparams variables in GeoServer SQL views? I have a sql view which take only one parameter, but this parameter is a list, and a need to know how can i pass this parameter in the url  Here is my sql view  SELECT * FROM shop WHERE id IN %list%   When I put the default value for %list% as (1, 2 ,3) as example, the layer preview works and show the shopa with the default ids,  but when I try this in the url  viewparams=list:(1,2,3)   does not work.   I already tried other things like   viewparams=list:"1,2,3"   but nothing works.  Does anyone know how to do this? Encouraging people to explain downvotes Note: If you're looking for a simple explanation as to why comments aren't required on downvotes, see .   I used to get "upset" (though that is too strong a term) when I got downvoted without comment. If my answer isn't good enough then I'd like to know why. Not only does it improve the answer for the OP but it improves my knowledge too.  Where the down-vote has been explained I've found it useful &amp; it has improved my answer, or forced me to delete the answer if it was totally wrong.  So is there any way we can encourage people to leave a comment? Perhaps they don't lose rep if they explain their down-vote?  I must admit though that I haven't always explained my down-vote either so you could call me a hypocrite. I've also grown a thicker skin over the months of using SO (it seems to have come with the higher rep score ;-)), so I'm less bothered about this now. Let $U,W$ be subspaces of a vector space $V$. Show that   $$\dim(U)+\dim(W)=\dim(U+W)+\dim(U\cap W)$$   Hint: Show that the map given by $L:U×W\to V$ given by $L(u,w)=u-w$ is linear.   I can show that $L:U×W\to V$ given by $L(u,w)=u-w$ is a linear map. I also know that the dimension of $U×W$ is $\dim(U)+\dim(W)$. What do I do next? Any hints? Give read-only access to specific folders? Lighting in a Minecraftian World Minecraft is a game that is largely based on a heightmap and uses that heigtmap information to flood the world with light.  From my understanding the highest point in the heightmap is the end of the sunlight influenced area.  Everything above that is lit by sunlight, everything below that just is influenced by light nearby in a radius of 8 blocks.  Thus if you have a floating island on the top of your world everything below that will be seen essentially as a cave.  When two lights influence the same point the brighter light wins (unsure about that).  Either way there are a couple of problems with minecrafts lighting model: first of all, if your world does not have a heightmap it becomes trickier to figure out what exactly is supposed to emit sunlight and what not.  A simple way would be to assume that the world is (in my case) a floating rock and then traverse each axis from both directions and figure out where the rock starts and ends.  But this does not fully eliminate the problem as dents in the rock are not supposed to be in darkness.  Minecraft itself will cache the light information in its chunks together with the information about the material of a block.  Thus only if the world is modified the lighting has to update.  Unfortunately that process is still pretty slow on updates and on quick light changes one can see the lighting lag behind.  That's especially true if a lot of blocks change (TNT, sunset etc.) and you're not running the fastest computer (Or Java on Mac).  From my still limited understanding of 3D graphics lighting a world like minecraft shouldn't be the biggest issue.  How would you tackle the problem?  I think the basic requirements for lighting in a voxel world would be   update fast enough that it could happen in a single frame.  One might be able to do the lighting in the graphics device and download the changed light information to the main RAM. light information must be quickly available for the main game logic so not entirely based on the graphics device: reasoning: light affects the growth of grass, spawning of monsters etc. light updates would have to be local to a chunk or have some other limit so that one does not have to relight the whole world which might be very large in size.   The main idea would be to make the light updates fast, not necessarily more beautiful. For general light rendering performance improvements one could easily add SSAO on top of that which should result in much nicer worlds. Given that indexing is so important as your data set increases in size, can someone explain how indexing works at a database-agnostic level?  For information on queries to index a field, check out . Prove that $\frac{a_1^2}{a_1+a_2}+\frac{a_2^2}{a_2+a_3}+ \cdots \frac{a_n^2}{a_n+a_1} \geq \frac12$ Let $a_1, a_2, a_3, \dots , a_n$ be positive real numbers whose sum is $1$. Prove that $$\frac{a_1^2}{a_1+a_2}+\frac{a_2^2}{a_2+a_3}+ \ldots +\frac{a_n^2}{a_n+a_1} \geq \frac12\,.$$  I thought maybe the Cauchy and QM inequalities would be helpful. But I can't see how to apply it. Another thought (might be unhelpful) is that the sum of the denominators on the left hand side is $2$ (the denominator on the right hand side). I would really appreciate any hints. Smaller membership symbol To mean that x is an element of X, we can write x \in X. However, in the standard packages, the membership symbol that results is too big; it draws too much attention to itself. This is especially evident when we're doing set theory and writing sets as lowercase, as in x \in y. Does anyone one how to draw a less attention-seeking membership symbol? Is the uncertainty principle just saying something about what an observer can know or is it a fundamental property of nature? I ask this question because I have read two different quotes on the  that don't seem to match very well. There are similar questions around here but I would like an explanation that reconciles these two interpretations specifically:   Feynman talks about the uncertainty principle in one of his lectures and mentions it as the reason why electrons don't crash into the atom's nucleus: If they did they would have an exact location and momentum which is not allowed by the uncertainty principle. In saying this it is clear that the uncertainty principle is a fundamental property of nature because it has an effect on where an electron can reside. Recently I read - somewhere else but I forgot where exactly - an account of the uncertainty principle where there was explained how we can measure position of a particle by firing another particle into it, the collision disturbs the velocity of the observed particle therefore we can not know its momentum anymore.   Now, 2) very much seems like a limitation of what the observer can know, while 1) attributes a fundamental property of nature to it (electrons don't crash into the nucleus). What is the correct way to think about this? How can I install the Google Apps Package (Play Store, ...) on my Android device? I have recently installed a custom ROM and cannot find the Play Store. It seems like all apps that belong to Google are missing.  How can I install the Google Apps Package (Play Store, ...) on my Android device? Passing a variable to sed Upon realizing it is a sarcophagus, he decides to sacrifice himself (I think by disconnecting his air) and exist in it for eternity along with the original creature. It may have been in an old Omni magazine, or some other periodical. I thought it may have been in the anthology "Dead Astronauts" but I did not find the story in there. I've got a small piece of code that is parsing an index value to determine a cell input into Excel.  It's got me thinking...  What's the difference between   xlsSheet.Write("C" + rowIndex.ToString(), null, title);   and  xlsSheet.Write(string.Format("C{0}", rowIndex), null, title);   Is one "better" than the other? And why? Encrypting a folder I'm familiar with bitlocker, having been using it for a while, but I am looking at just encrypting a folder instead. But I just don't understand the options it's giving me.  When I right-click a folder > properties > advanced > [x] encrypt contents to secure data > OK &lt; apply > ...  I get:  () apply changes to this folder () apply changes to this folder, sub-folder and files.   This doesn't make sense to me at all, if I encrypt a folder then the whole folder, everything within it is encrypted, then why should I be given these options, how can I have a folder encrypted and files within that folder unencrypted, that seems stupid to me, it doesn't make sense at all.  Can anybody explain why these options exist and how can I simply encrypt a folder?