Find every combination of a list of integers split into exactly two subsets
How to get all possible combinations of a list’s elements?
Some websites have code to "break out" of IFRAME enclosures, meaning that if a page A is loaded as an IFRAME inside an parent page P some Javascript in A redirects the outer window to A.  Typically this Javascript looks something like this:  &lt;script type="text/javascript"&gt;   if (top.location.href != self.location.href)      top.location.href = self.location.href; &lt;/script&gt;   My question is: As the author of the parent page P and not being the author of the inner page A, how can I prevent A from doing this break-out?  P.S. It seems to me like it ought to be a cross-site security violation, but it isn't. $x^{p-1} + ... + x^2 + x + 1$ is irreducible using Eisenstein's criterion? Eisenstein's criterion says that for a prime $p$ if the following conditions are satisfied for a primitive polynomial, $f(x)$, then that polynomial is irreducible in $\mathbb{Z}[x]$  $p \mid a_0, a_0, ..., a_{n-1}$   $p \not\mid a_n$  $p^2 \not\mid a_0^2$  Now I am almost certain I read somewhere that this lemma can be used to prove that the polynomial $x^{p-1} + x^{p-2} + ... + x^2 + x + 1$ is irreducible.  All coefficients are $1$ though and we have have an awkward amount of terms, $p - 1$ terms as opposed to $p$ terms - so how can Eisenstein's criterion be applied here? How to align checkboxes and their labels consistently cross-browsers This is one of the minor CSS problems that plague me constantly. How do folks around Stack Overflow vertically align checkboxes and their labels consistently cross-browser? Whenever I align them correctly in Safari (usually using vertical-align: baseline on the input), they're completely off in Firefox and IE. Fix it in Firefox, and Safari and IE are inevitably messed up. I waste time on this every time I code a form. Here's the standard code that I work with:   &lt;form&gt;     &lt;div&gt;         &lt;label&gt;&lt;input type="checkbox" /&gt; Label text&lt;/label&gt;     &lt;/div&gt; &lt;/form&gt;    I usually use Eric Meyer's reset, so form elements are relatively clean of overrides. Looking forward to any tips or tricks that you have to offer! Submitting a form by pressing enter without a submit button Well I am trying to submit a form by pressing enter but not displaying a submit button. I don't want to get into JavaScript if possible since I want everything to work on all browsers (the only JS way I know is with events).  Right now the form looks like this:  &lt;form name="loginBox" target="#here" method="post"&gt;     &lt;input name="username" type="text" /&gt;&lt;br /&gt;     &lt;input name="password" type="password" /&gt;     &lt;input type="submit" style="height: 0px; width: 0px; border: none; padding: 0px;" hidefocus="true" /&gt; &lt;/form&gt;   Which works pretty well. The submit button works when the user presses enter, and the button doesn't show in Firefox, IE, Safari, Opera and Chrome. However, I still don't like the solution since it is hard to know whether it will work on all platforms with all browsers.  Can anyone suggest a better method? Or is this about as good as it gets? Using Gimp to batch convert images to another format in Windows As implied by the title, does anybody know how to use the gimp-console-[version].exe program to batch convert images between formats (with default settings) in Windows ? How much can a grappler with reach move a grappled creature inside its reach? Will the silhouette formula change depending on the distance metric? I am using Silhouette width to compute the best value for k in k-means. As I am performing document clustering, I am calculating the values of a and b as follows in Python:  a = distance(data[index], centroids[clusters[index]], metric=metric, p=p) b = min([distance(data[index], c) for i,c in enumerate(centroids) if i != currentindex]) score = float(b - a) / max(a, b) if max(a, b) &gt; 0 else 0.0   The original formula from the  is the following:    I am using a cosine similarity measure to compute the distances and was wondering if this formula needs to be changed or it can be left as is. In the above snippet of code, the function distance computes the cosine similarity metric. How to sample from a discrete distribution? Assume I have a distribution governing the possible outcome from a single random variable X.  This is something like [0.1, 0.4, 0.2, 0.3] for X being a value of either 1, 2, 3, 4.  Is it possible to sample from this distribution, i.e. generate pseudo random numbers upon each of the possible outcomes given the probability of that outcome. So if I wanted to know what the probability of getting a 2 is, the sampling operation may return 0.34 or something like that.  The reason I ask is that I'm trying to implement an action selection policy for a reinforcement learning method based on a research paper. From what I gather from the paper, the author is able to sample the distribution by "mapping the uniform distribution U[0,1] through cumulative probability density functions obtained by adaptive numerical integration". From this he then samples the transition probabilities for each trial...  I would be grateful for any info on this...  Thanks in advance Should I assign dwellers to the storage room? I've played Fallout Shelter for a while now and normally use dwellers with appropriate SPECIAL stats for each room (Strength in the reactor, Perception in the water supply, etc).  However, I have a question regarding Endurance. The only room which uses this is the storage room. It doesn't produce anything; it has no cooldown; it just does nothing...  Even if I just build and upgrade the warehouse, my stock capacity is increased. Is there any good reason for me to waste my dwellers by assigning them to storage rooms? Include the "People Reached" and "Helpful Flags (count)" data in SEDE Proof that a Combination is an integer Why do I get "warning longer object length is not a multiple of shorter object length"? Can the Earth's magnetic field be used to generate electricity? Show only hidden files (dot files) in ls alias Can I replace my road bike's front wheel quick release with any quick release? I lost my road bike's quick release. Pictured are what I lost. Do I need to find a specific quick release that fits, or does one size fit all/most? What is the "canary thread" and why is it starving? The following occasionally appears in /var/log/syslog:  rtkit-daemon[1145]: The canary thread is apparently starving. Taking action. rtkit-daemon[1145]: Demoting known real-time threads. rtkit-daemon[1145]: Successfully demoted thread 1431 of process 1368 (n/a). rtkit-daemon[1145]: Successfully demoted thread 1430 of process 1368 (n/a). rtkit-daemon[1145]: Successfully demoted thread 1368 of process 1368 (n/a). rtkit-daemon[1145]: Demoted 3 threads.   What's going on here? Mark's generosity in this crisis seems to more than make up for his earlier stinginess.   Should those sentences always be avoided, or are there cases where they are valid? Making pen and ink corrections on a UK visa form? After printing out a UK visa form, can you cross out planned arrival date with a pen and write a new one? How to dynamically create a local variable? Compute $\iint\limits_R\frac{y}{x+y^2}dA$ where $R=[0,1]\times[1,2]$ Compute $\displaystyle\iint\limits_R\frac{y}{x+y^2}dA$ where $R=[0,1]\times[1,2]$  $\displaystyle\int_0^1\int_1^2\frac{y}{x+y^2}dydx=\int_0^1\int_1^2y(x+y^2)^{-1}dydx$  How do I integrate the denominator if the superscript is $-1$?   Hints are appreciated!