Why can't I inherit from a private class / interface? Why is this illegal in C#?  class Foo: Foo.BaseFoo //Circular base class dependency compile time error {    private class BaseFoo {...}     ... }   I'm not arguing when this could be useful or not, but I'd like to know what are the reasons that would disallow such code to compile. A similar restriction happens with private interfaces.  UPDATE  Seeing that its a duplicate I'll center the question more in why this isn't valid with interfaces which seems more useful?  And, what's more, why does it seem to be legal with the Roslyn preview as shown
Why can't a class extend its own nested class in C#? For example:  public class A : A.B {     public class B { } }   Which generates this error from the compiler:     Circular base class dependency   involving 'A' and 'A.B'   I always figured a nested class behaved just like a regular class except with special rules concerning accessing the outer class's private members, but I guess there's some implicit inheritance occurring between the two classes?
How do I test for an empty JavaScript object? Take the following class as an example:  class Sometype {     int someValue;      public Sometype(int someValue)     {         this.someValue = someValue;     } }   I then want to create an instance of this type using reflection:  Type t = typeof(Sometype); object o = Activator.CreateInstance(t);   Normally this will work, however because SomeType has not defined a parameterless constructor, the call to Activator.CreateInstance will throw an exception of type MissingMethodException with the message "No parameterless constructor defined for this object." Is there an alternative way to still create an instance of this type? It'd be kinda sucky to add parameterless constructors to all my classes. This issue came up when I got different records counts for what I thought were identical queries one using a not in where constraint and the other a left join. The table in the not in constraint had one null value (bad data) which caused that query to return a count of 0 records. I sort of understand why but I could use some help fully grasping the concept.  To state it simply, why does query A return a result but B doesn't?  A: select 'true' where 3 in (1, 2, 3, null) B: select 'true' where 3 not in (1, 2, null)   This was on SQL Server 2005. I also found that calling set ansi_nulls off causes B to return a result. How do I create a villager with custom trade offers? I'm trying to set up a shop system in a vanilla minecraft realm and villagers seem like the most streamlined method of doing so, however I'd also like to make it so that other players on the server can program their own villager, or have me program it for them as an operator so that other players can trade with each other through the villager. I figure that since villagers now have a secret inventory, they can collect items, but I was wondering if there's any way to access the items traded to them or if they just disappear.  Currently my thoughts are that a player would initiate a trade, the villagers sells would be linked to individual slots in a chest and the villager buys could be linked to another chest, allowing the player to fill a chest and thus 'program' their villager, and that finally a third chest would be filled with the item the villager receives, while the chest containing the trades would decrement the specific number of the item in the relevant slot. Limit question on independent random variables (Exercise 4.2.4 from Grimmett and Stirzaker) Let $\{X_r | r \geq 1\}$ be independent and identically distributed with distribution function $F$ satisfying $F(y) &lt; 1$ for all $y$, and let $Y(y) = \min \{k | X_k &gt; y\}$. Show that $$ \lim_{y\rightarrow \infty} P(Y(y) \leq E[Y(y)]) = 1 - e^{-1}. $$  I managed to show that $E[Y(y)] = \alpha(y) = (1 - F(y))^{-1}$ and that $$ \lim_{y\rightarrow \infty} P(Y(y) \leq E[Y(y)]) = \lim_{y \rightarrow \infty} \left( \sum_{i = 1}^{\lfloor \alpha(y) \rfloor} {\lfloor \alpha(y) \rfloor \choose i} (-1)^{i+1} \alpha(y)^{-i} \right). $$ And the expression on the right, according to Mathematica, does indeed seem to converge to $1 - e^{-1}$. But how can I show that this is true? Can anyone give me a hint? How to export Polygons to CSV with coordinates? I am very new to QGIS, so please bear with me.  I have a ".shp" file, which is contains a set of boundaries for suburbs of Australia. I opened it to QGIS and I would like to export it into a CSV file so that the final file would be like following.  POSTCODE, LATITUDE, LONGITUDE  When I select "Layer > Open attribute table" I can see the "postcode" column.  I had a look at a similar question here     Which told me to simply go to "Layer > Save as" and then type "GEOMETRY=AS_XY" or "GEOMETRY=AS_XYZ" in the "Layer" section of the "OGR creation options".  I followed exactly, but the latitude and longitude values are not being returned. Construction of $\mathbb{CP}^2$ from $S^2\times S^2$ Show that $\mathbb{CP}^2$ is homeomorphic to the orbit space of $(S^2\times S^2)/\mathbb{Z}_2$. The action is given by $(x,y) \mapsto (y,x)$. My attempt: I can see that $S^2\times S^2$ is a subset of $S^5$. I am unsuccessfully trying to restrict the action of $S^1$ on $S^5$ to $S^2\times S^2$ to get the required map. How to transit through Delhi without a visa? How are first digits of $\pi$ found? Since Pi or $\pi$ is an irrational number, its digits do not repeat. And there is no way to actually find out the digits of $\pi$ ($\frac{22}{7}$ is just a rough estimate but it's not accurate). I am talking about accurate digits by either multiplication or division or any other operation on numbers.  Then how are the first digits of $\pi$ found -     3.1415926535897932384626433832795028841971693993...   In fact, more than 100,000 digits of $\pi$ are found (sources - )  How is that possible? If these digits of $\pi$ are found, then it must be possible to compute $\pi$ with some operations. (I am aware of breaking of circle into infinite pieces method but that doesn't give accurate results.)  How are these digits of $\pi$ found accurately? Can it be possible for a square root of some number to be equal to $\pi$? Approximation algorithms for min vector subset-sum over GF(2) In  vzn asked about the following problem, which I'll call Vector-Subset-Sum.     Given a set of vectors $v_i$ over GF(2) and a target vector $y$, is there a subset of the $v_i$ summing to $y$?   In the answers, comments, and referenced papers I noted   The decision problem is in P. The natural minimization problem (finding the smallest subset) is NP-hard. It's related to the problem of finding sparse codewords in a linear code.   My question is: are there any known polynomial-time approximation algorithms for the minimization problem in (2)? I know very little about coding theory, so there may be some obvious or well-known approximation-preserving reductions to (3) that I have not seen. var self = this? Using instance methods as callbacks for event handlers changes the scope of this from "My instance" to "Whatever just called the callback". So my code looks like this  function MyObject() {   this.doSomething = function() {     ...   }    var self = this   $('#foobar').bind('click', function(){     self.doSomethng()     // this.doSomething() would not work here   }) }   It works, but is that the best way to do it? It looks strange to me. In 1735 Euler gave the value of $\gamma$ as $0.577218.$ The constant is generally defined as the limit of the difference between the harmonic series and $\log n:~\gamma= \lim_{n\to\infty}\sum_{k=1}^{n}\frac{1}{k}-\log n.$ Euler apparently relished this sort of calculation and must have taken quite a few terms to get such a good approximation.  My question is whether without a computer one can now prove that  $$\gamma &lt;  \sqrt{1/3}$$   with at least some savings in terms of the type of work Euler apparently expended? I don't think there's any point in raising the bar to $\gamma &lt; \ln 2\sqrt{\frac{23}{29}} $  because it seems to be the same sort of question.       My own thought was to compare $\frac{1}{2}\int_0^{1/3}\frac{dx}{\sqrt{x}}$ to something like $(-1)\cdot\int_0^\infty e^{-u}\ln u~du$ but I expect there's a better way. This is the PATH variable without sudo:  $ echo 'echo $PATH' | sh  /opt/local/ruby/bin:/usr/bin:/bin   This is the PATH variable with sudo:  $ echo 'echo $PATH' | sudo sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin   As far as I can tell, sudo is supposed to leave PATH untouched. What's going on? How do I change this? (This is on Ubuntu 8.04).  UPDATE: as far as I can see, none of the scripts started as root change PATH in any way.  From man sudo:      To prevent command spoofing, sudo   checks ``.'' and ``'' (both denoting   current directory) last when searching   for a command in the user's PATH (if   one or both are in the PATH). Note,   however, that the actual PATH   environment variable is not modified   and is passed unchanged to the program   that sudo executes. Improving how suggested edits are displayed in your activity history Issue 1: I find it a bit irritating that when I click the Improve button and further edit it, even if I mark it as helpful, only Community takes the credit for the approval. I know the topic itself will contain the link to the suggested edit, but my activity history only says that I made an edit, and not approved a suggested edit. The same holds true for marking one as unhelpful. The activity history should say I rejected an edit, and then made an additional edit. I know it's not often, but sometimes I do try to go back to a suggested edit I've rejected, but when I improved and rejected, it's not traceable for me as it doesn't show in my history or in the question's revision history. So if I don't remember what user suggested it, it's lost to me.  This issue also plagues the  which are awarded for approving and rejecting suggested edits, which essentially you have done, you're just not receiving credit for it. I suggest that when I mark an edit as helpful or not helpful, both me and Community be listed as the approvers or rejecters, unless another user is already listed in the appropriate place.  Update: Here is  of the confusion this causes.  Update 2: Also, when improving a post and marking it as "not helpful", it would be nice to be able to  along with it.    Issue 2: Expanding off the idea that users need more notice for suggested edits that get rejected, the activity history page is much too useless when it comes to listing the suggested edits a user has made. Literally all it does is list them. A user still has to click through to each one in order to find out if it was approved or rejected, or even if it's still pending. Take, for example, this screen shot of the suggested edit history:    Is it really necessary to say I suggested a suggested edit? Really? Of course I suggested it, it's a suggested edit. This isn't !  A good way to fix this would be to change the second "suggested" word into one of: pending, approved, or rejected. This would be a quick way to tell which edits have been approved or rejected and which ones are still pending. Users would be able to target out rejected edits and review them for the reasons. Something like this: How do I stop my rim brakes making a squeaking/squealing sound? I bought a Schwinn Frontier Sport few months ago and started riding happily. After a few weeks my front rim brakes started creaking. It's so annoying in public places. My rear brake doesn't produce any sound but isn't as powerful as the front brake.  The retailer says cleaning would solve the front brake's issues and I got it cleaned, but nothing changed. Is there something I can do something myself to fix this? Where can I get a clean ISO of a specific build of Windows 10? Video produced from images only plays in VLC but no other players Let $p\in[1,\infty]$, $a\in\ell^\infty$ and $$T:\ell^p\to\ell^p\;,\;\;\;x\mapsto ax.$$ Note that $\left\|T\right\|=\left\|a\right\|_{\ell^\infty}$. It's easy to see that if $a\in\ell^1$, then $T$ is nuclear and hence compact.  Can we more generally conclude that $T$ is compact?  Assume $p&lt;\infty$. The intuitive approach would be to define $$T_n:\ell^p\to\ell^p\;,\;\;\;x\mapsto(a_1x_1,\ldots,a_nx_n,0,\ldots)$$ for $n\in\mathbb N$ and to show that $\left\|T_n-T\right\|\to0$. Now, $$\left\|(T_n-T)x\right\|^p=\sum_{i=n+1}^\infty|a_ix_i|^p\tag1$$ for all $x\in\ell^p$ and $n\in\mathbb N$. The right-hand side of $(1)$ clearly converges to $0$ as $n\to\infty$, but this only yields convergence in the strong operator topology. On the other hand, if $(a_n)_{n\in\mathbb N}$ would be nonincreasing and $a_n\to0$ (e.g. $a_n=\frac1n$), then $$\left\|(T_n-T)x\right\|^p\le|a_{n+1}|^p\left\|x\right\|_{\ell^p}^p\tag2$$ for all $x\in\ell^p$ and $n\in\mathbb N$ and we could immediately conclude $\left\|T_n-T\right\|\to0$. EDIT: Maybe the general result can be obtained from the convergence in strong operator topology (which holds by $(1)$) by noting that $\ell^p$ has the approximation property; but I'm not sure whether this is true. Maximum Likelihood Estimate with different parameters Suppose that X and Y are independent Poisson distributed values with means $\theta$ and $2\theta$, respectively. Consider the combined estimator of $\theta$ $$ \tilde{\theta} = k_1 X + k_2 Y $$ where $k_1$ and $k_2$ are arbitrary constants.   Find the condition on $k_1$ and $k_2$ such that $\tilde{\theta}$ is an unbiased estimator of $\theta$. For $\tilde{\theta}$ unbiased, show that the variance of the estimator is minimized by taking $k_1 = 1/3$ and $k_2 = 1/3$. Given observations $x$ and $y$ find the maximum likelihood estimate of $\theta$ and hence show that $\tilde{\theta}$ is also the maximum likelihood estimator.   I have gotten (1) and (2) okay, but it's (3) I am having trouble with, I'd be okay if $X$ and $Y$ had the same parameter but I'm having trouble with $X$ and $Y$ having different parameters, any help would be appreciated.   NOTE   For (1) I got $k_1 = 1 - 2k_2$.   For (2) I found the variance of $\tilde{\theta}$, then differentiated and let equal to zero to minimize - therefore we get (after subbing in $k_2 = 1 - k_1/2 $) $$3k_1-1=0,$$ which when subbing in $1/3$, we see it is minimised.   Thank you. Is this sentence acceptable?     You’re welcome, have a nice day ahead.