Given an lambda expression, I need a way to store a compiled delegate in a dictionary, so i don't need to compile them each time.  My first attempt was caching delegates by expression converted to string:  class ExpressionEqualityComparer : IEqualityComparer&lt;Expression&gt; {     public bool Equals(Expression a, Expression b)     {         return a.ToString().Equals(b.ToString());     }     public int GetHashCode(Expression e)     {         return e.ToString().GetHashCode();     } } void Main() {     var e1 = (Expression&lt;Func&lt;object, string&gt;&gt;)(o =&gt; ((Model)o).Prop);      Console.WriteLine(e1.ToString());      d.Add(e1, e1.Compile());      var e2 = (Expression&lt;Func&lt;object, string&gt;&gt;)(o =&gt; ((Model2)o).Prop);     try     {         d.Add(e2, e2.Compile());     }     catch     {         // ArgumentException. An element with the same key already exists in the Dictionary&lt; TKey, TValue &gt;.     }     Console.WriteLine(e2.ToString());        Console.WriteLine(d.Count); } Dictionary&lt;Expression, System.Func&lt;object, string&gt;&gt; d = new Dictionary&lt;Expression, System.Func&lt;object, string&gt;&gt;(new ExpressionEqualityComparer()); class Model {     public string Prop { get; set; } } class Model2 {     public string Prop { get; set; } }   Output:  o =&gt; Convert(o).Prop o =&gt; Convert(o).Prop 1   This approach does not work because Expression.ToString() is not detailed enough to provide equality, and it's not reliable since there is no guarantee about the ToString implementation in general.  How to implement Equals(Expression, Expression) and GetHashCode(Expression) correctly without visiting the expression nodes?  If it's not possible with expression instance, is it possible with some other language construct, wrapping the original expression, which can be used to obtain the said expression?  The absolute requirement, which makes this question different from duplicates: Working in constant amortized time proportional to average size of the expression, which is the requirement to keep original hash function algorithmic properties.
Given a method signature:  public bool AreTheSame&lt;T&gt;(Expression&lt;Func&lt;T, object&gt;&gt; exp1, Expression&lt;Func&lt;T, object&gt;&gt; exp2)   What would be the most efficient way to say if the two expressions are the same? This only needs to work for simple expressions, by this I mean all that would be "supported" would be simple MemberExpressions, eg c => c.ID.  An example call might be:  AreTheSame&lt;User&gt;(u1 =&gt; u1.ID, u2 =&gt; u2.ID); --&gt; would return true
I need to run IE 10 in 32-bit mode on 64-bit Windows 7 Enterprise N.  When I run IE 10 from "C:\Program Files (x86)\Internet Explorer" I can see in task manager that I have only one process "iexplorer.exe" and no process "iexplorer.exe *32".  I have an application with an ActiveX that is supported only on 32-bit, and the application can't be loaded on 64-bit mode.  Is there a way I can force IE10 to run in 32-bit mode? How do I install different (upgrade or downgrade) PHP version in still supported Ubuntu release? I am trying to update to install PHP 5.5, 5.6 or 7.0 in Ubuntu 12.04/14.04/16.04 LTS, and I can only get PHP 5.3.10 for Ubuntu 12.04, PHP 5.5.9 for Ubuntu 14.04 or PHP 7.0.4 for Ubuntu 16.04 using official repositories (using apt-get).  I'm not really sure how to do a manual update – as I need:   to play around with the new(est) PHP features to install older PHP version due support in the software Javascript - Change html tag type How do I remove hidden backup files? I have files ending in ~ in my home directory, and I want to delete them. How do I do that? How do I prevent this backup functionality? Change the word "Chapter" to something else I am using fancyhdr. With that, using the command  \renewcommand{\chaptername}{Lecture}   has no effect. How can I change the name "Chapter" into something else? When I try to start Runescape I get an error message that says: CLassNotFoundException and lists Rs2Applet.class. How do I fix this so I can play? Assume the standard situation, that is, let $X_1, \ldots , X_n$ be independent and identically distributed with $X_k ∼ P_\theta(x; \theta)$ , where $P_\theta(x; \theta) = 2x/\theta^2$  if $0\le x \le\theta$ and $0$ otherwise. It is required to estimate $\theta$. Show that the maximum likelihood estimator for $\theta$ is $\hat{\theta} = \max{[X_1, \ldots , X_n]}$ and then show that the cumulative distribution function of $\hat{\theta}$ is $F_\theta(z) = z^{2n}/\theta^{2n}$. Here's what i did so far: Maximum Likehood estimator: $L_x(θ) = \prod_{i = 1}^{n} P_θ(x_k)$ Here we have $P_θ(x_1,...,x_n;θ) = P_θ(x_1,θ).P_θ(x_2,θ)...P_θ(x_n,θ)$ Likehood = $L_{x,θ}(θ) =P_θ(x_1,θ).P_θ(x_2,θ)...P_θ(x_n,θ)= 2x_1/θ^2. 2x_2/θ^2.. 2x_n/θ^2 = [2^n.\prod_{i = 1}^{n}x_i]/θ^{2n}$ Log-likehood: $\sum_{i = 1}^{n}log(P_θ(x_1,...x_n;θ))= \sum_{i = 1}^{n}log(2x_i/θ^2)$ Is this correct so far? Im still not sure how to get to $\hat{θ} = max{[X_1, . . . , X_n]}$ As for the the cumulative distribution part to show $F_θ(z) = z^{2n}/θ^{2n}$: $F(z) = P(max({x_k})&lt;z) = P(x_1&lt;z).P(x_2&lt;z)..P(x_n&lt;z) = 2x_1/θ^2.2x_2/θ^2...2x_n/θ^n = 2^n.\prod_{i = 1}^{n}x_i/θ^2n$ Not sure if this is correct. Would really appreciate some help. Edit: From the answers below, we can deduce the the estimator is biased. What estimator would be unbiased? How can i find it? In electromagnetism, why does nature prefer the right-hand rule over the left-hand rule? User suggested great corrective edit to my answer, but the edit was rejected. What can I do to approve it? Installing Ubuntu with Fake RAID 1 How do I set up new users with skel i have on my server a settings i use for all my users. every time i create a new user i have to copy all the settings over and over.  for example:   .vimrc. .profile .bashrc firefox homepage to our intranet evolution settings (server and username) etc...   i saw skel can do it, is there a easy way to setup a user with my settings when i adduser?  thanks I have a table:  table votes (     id,     user,     email,     address,     primary key(id), );   Now I want to make the columns user, email, address unique (together).  How do I do this in MySql?  Of course the example is just... an example. So please don't worry about the semantics. My grandparents bought a flight on United Airlines, as the one and same ticket, from Toronto, to ORD with one 55-minute layover, then to Maui. :     You won’t need to pay extra for airfare if you miss the flight, but on the other hand, you will most likely not be compensated by the airline for the incurred delay. It always depends on the amount of time, the reason for the delay and the airline’s policies. As soon as it’s weather-related, you won’t be getting a penny (and that’s normal: airlines can’t control the weather).    Yet they obviously prefer to avoid such charges from missing the 2nd flight.   Please see the titled question? Would they need to hotfoot or scamper from one gate to another, to not miss the 2nd flight? If yes to 2, can they request an airport electric shuttle cart now, before the flight? So this homework question is in the context of $\mathbb{R}$ only, and we are using Lebesgue measure.  The sum $A+B$ is defined to be $A+B=\{a+b|a\in A,b\in B\}$. The question is: If $m(A),m(B)&gt;0$, is it necessarily the case that $A+B$ contains an open interval?  This question is quite annoying, since it is quite difficult to calculate the sum even after you construct an example. However, it seems like no matter how I constructed a set of positive measure, there is a region that have a lot of point in it (yet this region is not necessarily dense). This suggest that when summed up, the holes should be covered up somehow and thus there would be an open interval, and so the answer is yes. Sorry for a rather vague idea, but I'm just not sure what to do with this problem. I have a feeling that somehow topology would have a way to capture precisely the idea above about a region with a lot of point.  (also, I think my middle school teacher mentioned this once, and I remembered the answer to be yes; but that is quite a while ago though)  Thank you. Any help will be appreciated.  EDIT2: So Camilo's answer is gone. I am looking at the convolution method right now. Because the convolution is continuous, if it is nonzero I am done. But then there is no guarantee that the convolution is nonzero even if $x\in A+B$. I still need help with this direction. Can someone give me some hints?  EDIT: Camilo's answer below essentially suggest the method of getting 2 open interval from regularity theorem, one cover a subset of A and one cover a subset of B such that the sum of the measure of these two subset is bigger than the measure of the larger interval. user99680's answer point to a wiki which show a method that essentially simply acquire an open set. After some thinking, I believe that these method simply can't be made to work. I constructed this example in the hope that it would convince you that it is the case:  Let $I_{0},I_{1},\ldots$ be disjoint open interval such that the distance between any 2 of them is nonzero and $m(I_{n})=9^{-n}$ and all of them are inside $[0,2]$. Let $J_{0},J_{1},\ldots$ be disjoint open interval such that the distance between any 2 of them is at least $3$ and $m(J_{3n})=m(J_{3n+1})=m(J_{3n+2})=\frac{m(I_{n})}{3}$. Let $O=\bigcup I_{n}$ and $H=\bigcup J_{n}$. Construct $A\subset O$ such that $m(A\bigcap I_{n})=\frac{3m(I_{n})}{4}$. Construct $B\subset H$ such that $m(B\bigcap J_{n})=\frac{3m(J_{n})}{4}$. Now if you apply Camilo's method, it is possible that your $I$ would be one of the $I_{n}$ above, and your $J$ is one of the $J_{m}$ above. No matter which $I_{n},J_{m}$ you have, the argument does not work. Rewrite $m=3q+r$ where $0\leq r\leq 2$. If $q&lt;n$ then $m(J_{m})&gt;m(I_{n})$ so the longer interval have length $\frac{m(I_{q})}{3}$; $m(A\bigcap I_{n})$ is at most $\frac{3m(I_{q+1})}{4}=\frac{m(I_{q})}{12}$ and $m(B\bigcap J_{m})=\frac{3m(J_{m})}{4}=\frac{m(I_{q})}{4}$. Thus $m(A\bigcap I_{n})+m(B\bigcap J_{m})$ is no larger than the larger interval. If $n\geq q$ then $m(I_{n})&gt;m(J_{m})$ so the larger interval is of length $m(I_{n})$; $m(A\bigcap I_{n})=\frac{3m(I_{n})}{4}$ and $m(B\bigcap J_{m})$ is at most $\frac{3m(J_{3n})}{4}=\frac{m(I_{n})}{4}$. Once again $m(A\bigcap I_{n})+m(B\bigcap J_{m})$ is no larger than the larger interval. Hence the Camilo's argument does not work. user99680's method does not work either, since you get $O$ and $H$ which is even bigger than any interval. Are the review queues planned for the iOS app? I enjoy reviewing on SO, is it currently possible to review on the iOS app? If not, is it planned to be implemented? Two trains travel on the same track towards each other, each going at a speed of 50 kph. They start out 100km apart. A fly starts at the front of one train and flies at 75 kph to the front of the other; when it gets there, it turns around and flies back towards the first. It continues flying back and forth till the two trains meet and it gets squashed. How far did the fly travel before it got squashed?  The question is relatively simple - the trains take an hour to collide, and in an hour the fly would travel 75 km. However, the question got me wondering: Lets say you are given a time $t$ in hours(where $t&lt; 1$) How many &quot;rounds&quot; would the fly make in $t$ time? A round  is defined as moving from one train to another and back. How would I model the equation? I would like to see an explicit example of a non-trivial elementary extension of the structure $(\mathbb{N}, +, \cdot, 0, 1)$ where $\mathbb{N}$ includes zero. Most of all I am interested in countable ones. Trig integral $\int ( \cos{x} + \sin{x}\cos{x}) \, dx $ Assume we have:  $$ \int (\cos{x} + \sin{x}\cos{x}) \, dx$$  Two ways to do it:  Use $$\sin{x}\cos{x} = \frac{ \sin{2x} }{2} $$ Then $$ \int \left(\cos{x} + \frac{\sin{2x}}{2} \right) \, dx = \sin{x} - \frac{ \cos{2x} }{ 4 } + C. $$ The other way, just see that $ u = \sin(x), du = \cos(x)dx $, $$ \int ( \cos{x} + \sin{x}\cos{x}) \, dx = \sin{x} + \frac{\sin^2{x}}{2} + C. $$  Now the part I don't see fully is, why aren't these results completely equal?  Taking the 2nd result, \begin{align} \sin{x} + \frac{\sin^2{x}}{2} &amp;= \sin{x} + \frac{1}{2} \, \left( \frac{1 - \cos{2x}}{2} \right) \\ &amp;= \sin{x} + \frac{1}{4} - \frac{\cos{2x}}{4}. \end{align}  So you have to absorb $\frac{1}{4}$ into $C$ for them to be equal.  Shouldn't they be equal straight away? Accessing site-specific Help Center from iOS app Can the Stack Exchange developers add an option to access the site-specific Help Center via the iOS app?  My use case is when I read a question that I think is off-topic, and want to double-check that the wording from the site's Help supports that position, having the Help Center available would be nice. From Rudin's Principles of Mathematical Analysis (Chapter 2, Exercise 6)  Let $E'$ be the set of all limit points of a set $E$. Prove that $E'$ is closed.  I think I got it but my argument is a bit hand wavy:  If $x$ is a limit point of $E'$, then every neighborhood of $x$ contains some $y\in E'$, and every neighborhood of $y$ contains some $z\in E$. Therefore every neighborhood of $x$ contains some $z\in E$, and so $x$ is a limit point of $E$. Then $x\in E'$, so $E'$ is closed.  The thing that's bugging me is the leap from one neighborhood to another. Is this formally correct?