I want to print the sum of all possible combinations of two items in this list - can you tell me what is wrong with the code below? Nothing happens when I run it.  gammas = [1.0,2.0,6.0,5.0,8.,4.] for i in range(len(gammas)):     for j in range(len(gammas)):         while (j&gt;i):             print gammas[i]+gammas[j]         if j==i:             break
I have a list with 15 numbers in, and I need to write some code that produces all 32,768 combinations of those numbers.   I've found  (by Googling) that apparently does what I'm looking for, but I found the code fairly opaque and am wary of using it. Plus I have a feeling there must be a more elegant solution.  The only thing that occurs to me would be to just loop through the decimal integers 1–32768 and convert those to binary, and use the binary representation as a filter to pick out the appropriate numbers.   Does anyone know of a better way? Using map(), maybe?
@Id @GeneratedValue but set own ID value Preventing LibreOffice from using smart quotes (“ ”) instead of (dumb) straight quotes? I use LibreOffice Calc to make lists of programs with different parameters to run on an hpc cluster. For each batch of commands I must do a find and replace on the smart quotes, as they cause errors in command line arguments. It would be nice to cut this step out of my work flow. Does anyone know how I might change the default punctuation used?  Edit: Apparently the title font transforms dumb quotes into smart quotes.  Smart quotes have a different symbol depending on if they are at the start or end (“ ”)  Dumb quotes use the same symbol for the start and the stop ( " ) How can I check if my computer's powerful enough to run a certain game? Is there a service that I can use to check if my machine will be able to run a certain game? Server 2008 Net Send or Msg? I have a Windows 2008 server running as a domain controller. The details are as follows:  Domain: corp Server Name: oxygen   The workstations are all running Windows XP SP3 and have fixed IP addresses.  I am trying to use the net send functionality to be able to send simple messages to either individual machines/users and also to all machines. This is so I can send a message to a user to alert them about something, or likewise alert everyone of something such as the server being rebooted.  Is this possible using Windows Server 2008? If so, what would the command be? I took a bunch of photos at my son's martial arts club using a D90 with a 50mm F1.8.  The club is lit with overhead fluorescent lighting, and I was getting some weird results where some shots are "white", others have an "orange cast", and still others are partly white and partly orange in the same shot.  I suspect it has to do with the combination of the frequency of the light flicker and with the camera shutter speed. Here is a sequence of 3 shots that show the problem.  The shots were taken with 1/500s at F2 and ISO-800 and with Auto-WB.  First shot ("white/normal"):    Second shot ("orange cast" at top):   Third shot ("orange cast" at bottom):   These were taken in burst mode within a second of each other.  Can anybody tell me what is going on?  And, how I can avoid this? crisscross, dillydally, riffraff, etc What if I accidentally run command "chmod -R" on system directories (/, /etc, ...) In an older question from June 2011, , apparently revived by the system, a user is asking about the origin of the rotation of celestial bodies.  The  (with 17 votes) states the following:     When things collapse under their own gravity in space (i.e. clouds of gas and dust), any small amount of asymmetry in the collapse will be enough start it spinning.   And then it goes on saying:     Even if it spins by a tiny amount, as it collapses, angular momentum     conservation will mean it spins more and more quickly.   Is all this really correct?  I could try to ask in a comment to the answer. I actually did. But the author is no longer registered.  Hence I am asking it as a question.  But that is not the end of the story. As I was about to ask my question, I looked for other relevant questions, and there are some. I did not make an exaustive survey, but I did not find one that had satisfactory answers:    (december 2011) has just one accepted answer (0 votes) stating essentially that the solar system has angular momentum because it started from a cloud that had angular momentum. No comment.  (july 2011) is questionning about everything from galaxies to electrons. The answers are of a much higher quality, but while they seem to justify the possiblility of spin and angular momentum (and its conservation), there are not clear on how it appears, at least for celestial bodies.  (june 2013): That was my own very naive first question on this site. It is related but does not directly address spin.   One answer I found is that momentum appear from bodies in relative motion past each other. Nice, but not really an answer: where did they get their relative speed to begin with. Unfortunately the answer is: from the angular momentum of larger structures they belong to (well, it can be more comples). So this is just chicken and egg explanation. But how did it get started?  Note that my question is not a duplicate, since it is primarily whether the above statements are correct, which is not considered in these other questions.  Furthermore, these questions are fairly old, and given that none had received answers that seem to answer the question of the origine of existence of celestial angular momentum (not in a way I can understand anyway), it may be appropriate to attempt restarting the process, with the above discussion to motivate that an answer should explain the physical mechanism that started the existence of spin of celestial bodies. Why is it “a defeated Napoleon, not “the defeated Napoleon” who rode off the battlefield and into exile? I noticed an infinite article; ‘a’ was used before ‘defeated Napoleon’ in the following sentence of Jeffery Archer’s novel, "Fales Impression" :  “General Sir Harry Wentworth sat at the right hand of the Iron Duke that night, and was commanding his left flank when a defeated Napoleon rode off the battlefield and into exile."  I’m curious to know why it should be “a defeated Napoleon,” not “the defeated Napoleon” or simply “defeated Napoleon.” Isn’t it only one Napoleon who was defeated the battle and exiled (to St. Helena). It looks like as though there were many (defeated) Napoleons who were exiled.  It’s always headache for me to handle articles as we Japanese (I think Chinese too) don’t have article as the basic part of speeches in our language system. I’ve studied it on English grammar text books at school, but have never reached full understanding of the usage of articles, because we don’t have that practice. Is there any special knack to master how to use articles? Do we really need polynomials (In contrast to polynomial functions)? Returning from a finally block in Java I was surprised recently to find that it's possible to have a return statement in a finally block in Java.  It seems like lots of people think it's a bad thing to do as described in ''. Scratching a little deeper, I also found '' which shows some pretty horrible examples of other types of flow control in finally blocks.  So, my question is, can anyone give me an example where a return statement (or other flow control) in a finally block produces better / more readable code? How is canon determined for the works set in the world of ASOIAF? How To Set Default Wallpaper As Login Screen Wallpaper [Automatically]? Do I need an ESTA if entering the US from Canada by train As a UK citizen, I will be flying to Vancouver (for which I will need an eTA) and then taking an AMTRAK train to Seattle. I will stay in Seattle for several days before returning to Vancouver and flying back to the UK. Do I need an ESTA for entering the US during this trip? How to prove the midpoint of a chord is also the midpoint of the line segment defined by the points of intersection of other two chords with it? What if the universe is rotating as a whole? Android/Java - Date Difference in days How to nest code within a list using Markdown How does one type Chinese in LaTeX? Bird flying in a cage Assume that you are holding a cage containing a bird.  Do you have to make less effort if the bird flies from its position in the cage and manages to stay in the middle without touching the walls of the cage? Does it make a difference whether the cage is completely closed or it has rods to let air pass?