Consider the following latex code:  \documentclass{article}  \usepackage{amssymb} \usepackage{amsthm}  \newtheorem{thm}{Theorem}  \newcommand{\Zn}[1][n]{\mathbb{Z}_{#1}}  \begin{document}  $\Zn[p]$  \begin{thm}[$\Zn$] \end{thm}  \end{document}   This compiles without errors obtaining:    Now, if I change the \Zn to \Zn[p] inside the theorem title:  \begin{thm}[$\Zn[p]$] \end{thm}   I get the following error when compiling:  ! Argument of \\Zn has an extra }. &lt;inserted text&gt;                  \par  l.14 \begin{thm}[$\Zn[p]                         $] Runaway argument? p) ! Paragraph ended before \\Zn was complete.   Yet the \Zn[p] outside the title works fine. Moreover if I put the command in a group, as in {\Zn[p]}, it compiles successfully with the expected output:  \begin{thm}[${\Zn[p]}$] \end{thm}   Is there something wrong with my definition of \Zn? Or is there a bug in how the theorem environment handles its title? Why does this happen?
I accidentally discovered () that a closing square bracket within an optional argument delimited by [ ] can cause problems.  Here is example code illustrating the issue:  \documentclass{article}   \begin{document}  \tableofcontents  \section[Square brackets ([ and ])]{Square brackets: [ and ]} % bad: the TOC now has "Square brackets ([ and", and the actual title is a mere ")".  Some text.  \section[{Square brackets ([ and ])}]{Square brackets: [ and ]} % good (works as originally intended)  Some text.  \end{document}   The text to be used as the optional (as well as the non-optional) argument contains a ], and this character is not supposed to function as the optional argument terminator but as a matching square bracket/parenthesis. Perhaps this is as it should be, but the question is how to best circumvent any potential problems. Enclosing this in a group works, but I don't know whether doing this has other side effects (perhaps not here in the case of \section but hopefully someone else has a better example of where grouping could lead to a problem). There is no (obvious) way other than writing [{ }] because [ and ] are not normally escaped. That [ and ] are normal characters and bear syntactic function (as optional argument delimiters) creates this potentially problematic situation.  Is simply enclosing the entire optional argument in a group ({ }) a good solution? Are there other/better ways?
Error: class X is public should be declared in a file named X.java This tiny little script deletes all small features in all layers. This works fine but the size of .shp files are not reduced. Please tell me why...  canvas = iface.mapCanvas() expr = QgsExpression("$length&lt;100") for l in canvas.layers():     l.startEditing()     it = l.getFeatures(QgsFeatureRequest(expr))     for ft in it:         l.deleteFeature(ft.id())     l.commitChanges() This is a  about securing public DNS resolvers   Open DNS servers seem pretty neat and convenient, as they provide IP addresses that we can use consistently across our company regardless of where they are located. Google and OpenDNS provide this functionality, but I'm not sure that I want these companies to have access to our DNS queries.  I want to set up something like this for use by our company, but I hear a lot about this being dangerous practice (particularly in regards to ) and I want to make sure that we do this right. What things do I need to keep in mind when building this type of environment? I can't retrieve my Facebook password I haven't been to my Facebook account in a while and I can't remember my password. When I try to have it reset, it goes to a security question, but I can't remember that either.    Is there anything I can do? Let $a_n=\sqrt[n]n-1$. Does $\sum_{n=1}^\infty a_n$ converge? How to change the size of desktop icons? I tried gconf-editor as given at  .  I am not getting the option for changing size at app &gt; nautilus &gt; icon_view.  I am using Ubuntu 11.10. Kindly help me in changing default icon size.   I want to make them small. Why is compactness in logic called compactness? In logic, a semantics is said to be compact iff if every finite subset of a set of sentences has a model, then so to does the entire set.   Most logic texts either don't explain the terminology, or allude to the topological property of compactness. I see an analogy as, given a topological space X and a subset of it S, S is compact iff for every open cover of S, there is a finite subcover of S. But, it doesn't seem strong enough to justify the terminology.   Is there more to the choice of the terminology in logic than this analogy? The equivalence between Cauchy integral and Riemann integral for bounded functions Definitions  Suppose $P\colon a=x_0&lt;x_1&lt;\dotsb&lt;x_n=b$ is a partition of $[a,b]$. Let $\Delta x_k=x_k-x_{k-1}$ and $\lVert P\rVert$ denotes $\max_{0&lt;k\le n}\Delta x_k$.  The Cauchy integral of a function $f$ on closed interval $[a,b]$ equals to $I$ if and only if for each $\epsilon&gt;0$, there's some $\delta&gt;0$, for each partition $P$ of $[a,b]$ such that $\lVert P\rVert&lt;\delta$, we have $\left\lvert\sum_{k=1}^nf(x_k)\Delta x_k-I\right\rvert&lt;\epsilon$.  Problem  If $f$ is bounded on $[a,b]$ whose Cauchy integral equals to $I$, then $f$ is Riemann-integrable and $\int_a^bf=I$.  Background  It's an exercise from our calculus(analysis) problemset book, and there's a hint: consider the partitions whose $x_k-x_{k-1}$ is a constant for different $k$'s, and try to estimate the Riemann sum for each of these partitions through the Cauchy integral.  I have no idea about such estimation. After drawing some pictures, I discouraged. I googled on the Internet and found an . I realized that it's a quite different approach and with some advanced techniques (such as the analysis of a positive measure set -- discontinuities). I hope there will be some simpler approachers, just as the hint says. I need a more detailed hint, or a solution. Can anybody help me? Thanks! Can you transfer a Windows 7 XP-mode VHD to a new PC without the need for reactivation? At the moment I am running Vista 32 bit and use VPC 2007 a lot. I have several Windows 2000 Virtual Machines set up with complex software configurations. For me, one of the advantages of working with VPCs is that a Virtual Machine can easily be copied to another PC (like a notebook). Also, when I move to a new PC, I can immediately work with my existing Virtual Machines without the need to reinstall all applications.   I am thinking about buying a new pc with Windows 7 64 bit pro, and using the XP-Mode Virtual Machine that comes with Windows 7. The advantages would be support for more memory (so being able to run more Virtual Machines simultaneously) and having a licenced XP Virtual Machine.  I would like to know if you can transfer a VHD that is based on the XP-mode VHD to another machine without Activation issues. The other machine will of course, also be running Windows 7. I would guess that this would not be a problem.   However, I did read about a guy who had to reinstall his Windows 7 because of a harddisk failure, and could not access his XP-mode VHD anymore because it demanded re-activation.  So can you transfer a Windows 7 XP-mode VHD to a new PC without the need for reactivation? How to determine if Javascript object is an event? Distinct Sylow P subgroups Edit - Original Title: Is there an alternative way to achieve border-collapse:collapse in CSS (in order to have a collapsed, rounded corner table)?  Since it turns out that simply getting the table's borders to collapse does not solve the root problem, I have updated the title to better reflect the discussion.  I am trying to make a table with rounded corners using the CSS3 border-radius property. The table styles I'm using look something like this:  table {     -moz-border-radius:10px;     -webkit-border-radius:10px;     border-radius:10px }   Here's the problem. I also want to set the border-collapse:collapse property, and when that is set border-radius no longer works. Is there a CSS-based way I can get the same effect as border-collapse:collapse without actually using it?  Edits:  I've made a simple page to demonstrate the problem  (Firefox/Safari only).  It seems that a large part of the problem is that setting the table to have rounded corners does not affect the corners of the corner td elements. If the table was all one color, this wouldn't be a problem since I could just make the top and bottom td corners rounded for the first and last row respectively. However, I am using different background colors for the table to differentiate the headings and for striping, so the inner td elements would show their rounded corners as well.  Summary of proposed solutions:  Surrounding the table with another element with round corners doesn't work because the table's square corners "bleed through."  Specifying border width to 0 doesn't collapse the table.  Bottom td corners still square after setting cellspacing to zero.  Using JavaScript instead- works by avoiding the problem.  Possible solutions:  The tables are generated in PHP, so I could just apply a different class to each of the outer th/tds and style each corner separately. I'd rather not do this, since it's not very elegant and a bit of a pain to apply to multiple tables, so please keep suggestions coming.  Possible solution 2 is to use JavaScript (jQuery, specifically) to style the corners. This solution also works, but still not quite what I'm looking for (I know I'm picky). I have two reservations:    this is a very lightweight site, and I'd like to keep JavaScript to the barest minimum  part of the appeal that using border-radius has for me is graceful degradation and progressive enhancement. By using border-radius for all rounded corners, I hope to have a consistently rounded site in CSS3-capable browsers and a consistently square site in others (I'm looking at you, IE).   I know that trying to do this with CSS3 today may seem needless, but I have my reasons. I would also like to point out that this problem is a result of the w3c specification, not poor CSS3 support, so any solution will still be relevant and useful when CSS3 has more widespread support. SQL Server 2008 R2 SP1  My company uses the Great Plains (GP) financial system with several customizations.  Our Value-Added-Reseller (VAR) for GP has setup most of these customizations in a separate database from the GP data called DYNCUSTOM.  In the DYNCUSTOM database is a View that is merely a SELECT * FROM a table in the GP company database (called PARTS).  I was approached by a user having problems trying to select on this view.  The error he was getting:  Msg 229, Level 14, State 5, Line 2 SELECT permission denied on object 'BM010415', database 'PARTS', schema 'dbo'   I looked at how his login was mapped and he had a database user in the DYNCUSTOM database belonging to a database role that was granted select on the view.  However, he did not have a database user in the PARTS database.    Usually the intent of a view is so that one can grant select permissions on the view without exposing access to the underlying table.  With SQL Server however, if the view crosses databases does it then change the security context being used?  Therefore, the user would also need a database user in the PARTS database as well as granted select access to the underlying table? Fastest way to determine if an integer's square root is an integer I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is another integer):    I've done it the easy way, by using the built-in  function, but I'm wondering if there is a way to do it faster by restricting yourself to integer-only domain. Maintaining a lookup table is impractical (since there are about 231.5 integers whose square is less than 263).   Here is the very simple and straightforward way I'm doing it now:  public final static boolean isPerfectSquare(long n) {   if (n &lt; 0)     return false;    long tst = (long)(Math.sqrt(n) + 0.5);   return tst*tst == n; }   Note: I'm using this function in many  problems.  So no one else will ever have to maintain this code.  And this kind of micro-optimization could actually make a difference, since part of the challenge is to do every algorithm in less than a minute, and this function will need to be called millions of times in some problems.    I've tried the different solutions to the problem:   After exhaustive testing, I found that adding 0.5 to the result of Math.sqrt() is not necessary, at least not on my machine. The  was faster, but it gave incorrect results for n >= 410881.  However, as suggested by , we can use the FISR hack for n &lt; 410881. Newton's method was a good bit slower than Math.sqrt().  This is probably because Math.sqrt() uses something similar to Newton's Method, but implemented in the hardware so it's much faster than in Java.  Also, Newton's Method still required use of doubles. A modified Newton's method, which used a few tricks so that only integer math was involved, required some hacks to avoid overflow (I want this function to work with all positive 64-bit signed integers), and it was still slower than Math.sqrt(). Binary chop was even slower.  This makes sense because the binary chop will on average require 16 passes to find the square root of a 64-bit number. According to John's tests, using or statements is faster in C++ than using a switch, but in Java and C# there appears to be no difference between or and switch. I also tried making a lookup table (as a private static array of 64 boolean values).  Then instead of either switch or or statement, I would just say if(lookup[(int)(n&amp;0x3F)]) { test } else return false;.  To my surprise, this was (just slightly) slower. This is because . What the pointer size in 64 bits computer in C++? Short story about a crew finding an ancient alien ship filled with tons of artifacts from their society SaveAsActivity is not allowed with whatId that is not supported as a task whatId Reserved words as names or identifiers Is there any tricky way to use Java reserved words as variable, method, class, interface, package, or enum constant names? Show that if $ \ A \cup B = A$ and $ \ A\cap B = A$ then $ \ A = B$ Question:  Show that if $ \ A \cup B = A$ and $ \ A\cap  B = A$ then $ \ A = B$  My attempt:  Proof by contradiction:  Assume $ \ A \cup B = A$ and $ \ A\cap  B = A$ and $ \ A \neq B$   Case 1: $ \exists \ x \in A, x\notin B$  If $ x \in A \implies x\in A \cap B \implies x \in A \ and \  x\in B  \implies x\in B$, a contradiction.   Case 2: $ \exists \ x \in B, x\notin A$  If $ \ x \in B \implies x\in A \cup B \implies x\in A$, since $ \ A \cup B = A$. Contradiction.   Is this approach correct? Could someone please show me how to do a direct proof? Is zero odd or even?