R data.table not preserving factor when applying function by group
data.table and table unexpected behavior
Why is Python running my module when I import it, and how do I stop it? Does existence of $\gcd$ implies PID? We know that if $A$ is a PID, then we can guarantee the existence of a $\gcd$ between two elements. My question is, does the converse hold? If I know that every two elements have a $\gcd$, do I know that the ring is a PID? My intuition says no, in that case I would like a counter-example.  Thanks. Why is disk usage greater than the size of all files on it? I'm refactoring my ASP.net application from ASP.net 3.5 to 4.0. Also I'm changing the URLs to user friendly URLs /product.aspx?id=100 to /product-name/100.  All my pages are indexed by search engines and the site has already been online for 6 years. I'm planning to do 301 redirect from the old pages to the new one.  I want to make sure I won't lose the rankings and traffic.  Any suggestion how to do it properly? Am I technically allowed to look up cards during a Magic tournament match? Am I allowed to look up a card during a game, if it's being played with serious Rules Enforcement? Either to read the full card from the Gatherer, or to try to find the exact card I'm vaguely thinking of.  Two possible scenarios:   An opponent has revealed a card previously, and I want to remember the exact details. (Something like the exact wording of a sorcery, mana cost, keywords on a creature, subtypes, etc. etc.) I have a "name a card and remove it from the opponent's deck" type card, and I want to, say, ask google for "Blue Gearhulk" to remember that it's that that one is called "Torrential Gearhulk".   Obviously, in casual or semi-casual games neither of these are a problem. Any reasonable opponent will just re-reveal the known card (assuming it IS still guaranteed to be known) or will accept "I name the Blue Gearhulk".  Also obviously, it seems unlikely that I (or anyone else) would get to the stage of playing at the REL without knowing the cards too thoroughly for this to be relevant.  But in principle... is it permitted? Or not? (and if not, is there a good reason, or just "we decided 'No'"?) Can an observer B move in such a way that his clock will run faster than that of a fixed observer A? My understanding of Special and General Relativity comes from books which attempt to explain them to non-experts in these fields.   Let A and B be observers, which at some time t(0), are together at some location P fixed to the earth's surface. A and B are provided with "clocks", which at time t(0), are identical lumps of the same radioactive element-that has a very long half-life. A and A's "clock" remain fixed to the earth's surface. B and B's "clock" leave A and stay together, but eventually return to A after some interval of time T (as measured by A's "clock"). If, during this time T, B's velocity relative to A is sufficiently close to the velocity of light or B remains close to a sufficiently massive body, it seems that time can "pass more slowly" for B than for A. So that when B rejoins A, B's "clock" will contain more of the radioactive element than A's "clock"   My question is: Are there any scenarios that B together with B"s "clock" can undergo (during the time T) which will cause time to "pass more quickly" for B than for A? So that when B rejoins A, B's "clock" will contain less of the radioactive element than A's "clock". If there are no such scenarios, is there any fact or law in Relativity theory which rules them out? My installation is a Ubuntu 12.04 64 bits (Classic "legacy" MBR - No  EFI/UEFI here) with two partition :   A separate boot partition An encrypted LUKS volume that contains the system Logical Volumes   I seems I accidentaly deleted all the current kernel files with:  sudo apt-get purge 'linux-image-3.8*'    I applied the updates with Ubuntu Software Update, rebooted and then: Ubuntu can't boot.  I tried to boot on a live DVD with a 14.04.1 Ubuntu and can still see my partitions (described later):  /dev/sda1 (boot) /dev/sda2 (Encrypted volume) /dev/sda5 (Logical Volume container)  What are the steps to recover/reinstall the kernel files and dependencies in order to cleanly reboot my installed system?  Thanks in advance Find Total number of ways out of N Number taking K numbers every M interval I have been stuck in a problem, that has thrown my brain out of the coding. This problem is at very high priority and I need the solution as early as possible. Problem is as :  There are exactly N advertising boards on the highway. Now a company want to advertise on some of these advertising boards(each advertising board costs some money) .  Company strategy is that, they want at least 'K' advertisement should be there among M consecutive advertising boards. But at the same time Company want to pay minimum for its advertisement .  Now, what is the total number of ways, different ways Company can advertise meeting its minimum cost strategy.  As for Example: N= 3, M = 2, K=1 ==> there is only one way for minimum cost, ie. 0C0 , where '0' denotes No company advertisement, and 'C' denotes company advertisement board.  Similarly, for N =4, M =2, K =1 ==> there is 3 possible ways, ie. C0C0, 0C0C, 0CC0.  Hope to get a reply from someone soon. Thanks. Getting filesystem path of class being executed Often I need two (or more) map frames in map layout to present different data next to each other. It is easy to make multiple map frames in QGIS Print Composer. BUT...  It is in the nature of my work that very often I need to update some map frames because data I am presenting in map changed or I need to add/remove layer, change scale, projection etc.  So if I create one map frame, lock it (Lock layers for map item), create second map frame with different layers, scale,projection etc. and than realize I need to change something in first frame, I can't find a simple way to do it...  To simply do that in Mapinfo, there are more Map Windows, in ArcGIS there are multiple Data Frames. What is in QGIS to achieve that? Sieve of eratosthenes infinite primes I don't understand why the sieve of eratosthenes doesn't prove an infinite number of primes.  For example the number 2 eliminates 1/2 of an infinite number of numbers.  The next prime, 3, eliminates 1/3 of the remainder, not 1/3 of all the numbers and so on.  5 would eliminate 1/5 of the remaining numbers. Why doesn't that prove an infinite number of primes? Thanks Accidentally ejected External drive while downloading file, now having problems reading I'm hoping someone can help! I recently downloaded a torrent directly onto an external hard drive, (using a 2009 MacBook Pro and 1TB Seagate Expansion portable Drive) somehow during the download the drive was accidentally ejected, since this incident when I plug the drive back in it’s having problems reading.  The drive works fine for about 10 minutes, I can read/copy/paste and access files but then starts to wreak havoc; apps hangs, it hangs the Finder, etc.  I’ve tried repairing it in Disk Utility, which reads and repairs this disk but problems inevitably continue as described above.  I’ve deleted the Torrent file also. All my files on this external drive so re-formatting is not an option until I can retrieve them. For positive real numbers $a,b,c$ with $abc = 8$ prove that   $$ \frac{a^2}{\sqrt{(1+a^3)(1+b^3)}} + \frac{b^2}{\sqrt{(1+b^3)(1+c^3)}} + \frac{c^2}{\sqrt{(1+c^3)(1+a^3)}} \geq \frac{4}{3}. $$   Can we prove this by Cauchy-Schwarz or Jensen's inequality? If not how? Finding the limit of $\frac {n}{\sqrt[n]{n!}}$ locating latitude-longitude point in a piste-map with matrix transforms I am trying to plot points of a particular latitude longitude on this image of a Swiss mountainous landscape.    What I am doing is I have some 54 known location-points plotted on this image (not visible in the linked image), which is a piste map, and is therefore an artist's impression of the landscape. I found out the latitude-longitudes and also height above sea level for these 54 known points. I opened my piste map in the GIMP, and plotted the 54 points, while at the same time reading their co-ordinates in points, in the piste-map. So, I have x-y coordinates (lat-long) and z coordinate (height above sea level) for all those 54 points (so its a 3d co-ordinate system that I have), and I also have X-Y coordinates of those places in my piste-map (a 2d co-ordinate system), and I assume a Z=1 for all those points.   To locate a particular lat-long on my piste-map(I have the coordinates for this place, i.e. the lat-long but not elevation), I need to calculate their X-Y on the piste-map. My approach is, that I calculate distances between this point which is to be located and those 54 known points , and then I sort them in ascending order. The first two points in this order will be the nearest points to the one which we want to locate. Now, I find my 3rd known point, and for that, I loop over the rest of the points, to get the nearest possible point such that this point forms a triangle with the first two closest points with the point which is to be located falling inside the formed triangle. Now, I have three known points forming a triangle say triangle ABC. For these known points, I have a triangle A'B'C' in the piste map, and the point to be located lies in the latter. I figure out the transform matrix which when multiplied with the 3X3 matrix of the three known points(in this 3X3 matrix, each row corresponds to a point, with the column values x,y and z in the 3d scape) results in a 3X3 matrix of those points in the piste-map. I multiply this transform matrix calculated with a new 3X3 matrix for three points, the first one being the point to be located, and the remaining two are the last two known points in the first 3X3 matrix. This way, the first two elements of my resulting matrix are the X and Y values for the point to be located, and I proceed ahead to draw the point on the piste-map. Is this approach correct with respect to the way I am using the transform matrix? Thanks! I would really appreciate if any alternative approaches are suggested as well! Removing nodes from graphs such that one is dependent on other - ZIO $2010$, P$1$ Greetings Community! The above problem you see is a combinatorics problem I could not solve. :( This problem is from ZIO $2010$, P$1$.     Here is what I did: Observe that every graph can be divided into "sub-groups" which may help in solving. We first remove the empty set. Then the singleton set. Consider the bigger but smaller than the sub-parts example:    The singleton sets are $\{4,5,6\}$ which are at the least position in the graph.   The dual sets are $\{2,4\}, \{3,5\}, \{3,6\}$, the bottom - two portions in the graph. The triplet sets are $\{2,4,5\}, \{4,5,6\}$ which we may manually count but for the bigger graphs in the sub-part, this may prove to be difficult and this is where I am stuck.   Any help would be appreciated. Thanks. Floor a date in SQL server In SQL Server, how do I "floor" a DATETIME to the second/minute/hour/day/year?  Let's say that I have a date of 2008-09-17 12:56:53.430, then the output of flooring should be:   Year:  2008-01-01 00:00:00.000 Month: 2008-09-01 00:00:00.000 Day: 2008-09-17 00:00:00.000 Hour: 2008-09-17 12:00:00.000 Minute: 2008-09-17 12:56:00.000 Second: 2008-09-17 12:56:53.000 This week we rolled out a series of changes to  of the question close workflow.  You can read more about the details of these changes .    For context, the overall effort to improve the question close experience will be optimized for Stack Overflow. Given Stack Overflow’s scale, many of the pain points we hear about with question closing and reopening are unique to Stack Overflow and won’t make sense for other network sites. However some  changes are general improvements that should improve usability and guidance overall. Wherever possible, we plan to roll these changes out network wide as well. Any time we roll out a change network wide, we’ll make sure to cross-post here. This first phase is being rolled out to the network and is why I’m posting today.  Let us know if you run into any issues or have questions regarding the network here. Is there an editor or IDE (or a script) for substituting the TeX-Commands $ and $$ for opening and closing math regions into the corresponding LaTeX-Commands \(,\) and \[,\]? I'm sure there is a tool - and I'm searching for. I think, this will result in better readable code. A simple search and replace wont do that - but with regular expressions, that should not be problem. I simply do not want to invent the wheel a second time. Over time, I've noticed an increasing practice among moderators of the smaller sites (i.e. not in the Trilogy) to move extended comment chains to chat, just because they're too long. Is this a good idea? In the past, I've taken the position on many occasions that I believe that comments serve two purposes only: clarification, and asking for clarification.  I take this position because as a mod I want the freedom to purge a comment trail that is clearly running off the rails without having to argue with anyone about politeness definitions. But that's not the same thing as two pedantic C++ language lawyers debating the finer points of &quot;undefined behavior.&quot;  I give wide latitude to such discussions, as long as the participants don't start throwing spears, because I believe they are instructive. The SE software even has accommodations for this.  Long comment chains are automatically collapsed, so as not to disrupt the Q&amp;A format of the post.  And moving a comment chain to chat is not even a move, really; to do an actual move, you have to perform the conversion, and then delete all of the copied comments from the post. Here is a recent example:  and it's accompanying . What I find amusing is that the OP's detailed POV about the term, where he floats a theory about why everyone thinks that &quot;bugged&quot; is not a thing (that conversation took place in the comments, and is now safely sequestered in the chat room) gets to stay prominently featured in his question, at the very top of the post. Now you could argue that the chat room is a better environment to have these discussions anyway, and you'd be right.  I could argue that if we're going to do that, then why not just automatically convert long discussions to chat rooms? The problem is not so much where the comments reside.  I don't understand why mods are taking it on themselves to fix something that isn't hurting the site (at least in my opinion).  In addition, every time I see this happen, the participants in the conversation immediately lose interest in it.  The only comment that was posted in that room after all the comments were moved is most likely this one:  It wouldn't surprise me if the folks using &quot;bugged&quot; to refer to a certain software quality are the same folks who refer to their programs as &quot;codes&quot; and who believe textspeak is the pinnacle of modern English.  Which nobody will ever see. :) Some mods are really aggressive about this.  I discussed this with a mod on Physics, and he told me that they routinely move discussions when they think they might run off the rails.