I am currently getting a distinct list of data. Properties are MDMMappingCode which is unique and CustNameReporting which can have duplicate data. Data being returned:  From my linq query the data being returned is correct but I only need 1 unique CustNameReporting instead of 5 being repeated. This issue I am facing is the MDMMappingCode is different. What should I change in my linq query to take the first record. Code List&lt;OptionDto&gt; customers = await _appDbContext.MasterDataCustomerActivityGrids                                     .Select(e =&gt; new OptionDto() { Value = e.MDMMappingCode, Label = e.CustNameReporting })                                     .Distinct()                                     .OrderBy(e =&gt; e.Label)                                     .ToListAsync(cancellationToken);  public class OptionDto {     public string Value { get; set; }     public string Label { get; set; } }
I am playing with LINQ to learn about it, but I can't figure out how to use Distinct when I do not have a simple list (a simple list of integers is pretty easy to do, this is not the question). What I if want to use  on a list of an Object on one or more properties of the object?  Example: If an object is Person, with Property Id. How can I get all Person and use Distinct on them with the property Id of the object?  Person1: Id=1, Name="Test1" Person2: Id=1, Name="Test1" Person3: Id=2, Name="Test2"   How can I get just Person1 and Person3? Is that possible?  If it's not possible with LINQ, what would be the best way to have a list of Person depending on some of its properties in .NET 3.5?
jQuery get the rendered height of an element? How do you get the rendered height of an element?  Let's say you have a &lt;div&gt; element with some content inside. This content inside is going to stretch the height of the &lt;div&gt;. How do you get the "rendered" height when you haven't explicitly set the height. Obviously, I tried:    var h = document.getElementById('someDiv').style.height;   Is there a trick for doing this? I am using jQuery if that helps. Can X.org Load Two Different Drivers? (Triple-Head Setup with Intel and NVidia Card) We want to set up a 3 screens with an onboard intel graphics adapter and an nvidia card.  Both cards are recognized in lspci   01:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2) 00:02.0 Display controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)   And bascially work: If I switch to the console, I see output on the Intel card, X is only running on the Nvidia card.  But when I type xrandr | grep conn I get only one connected port:   DVI-I-0 disconnected (normal left inverted right x axis y axis) VGA-0 disconnected (normal left inverted right x axis y axis) DVI-I-1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm HDMI-0 disconnected (normal left inverted right x axis y axis)   I am on Ubuntu 12.10 (and XFCE) and installed the proprietary nvidia driver.  I was assuming that X maybe has a problem to autodetect both cards, so I thought the following xorg.conf could help:   Section "ServerLayout"     Identifier     "Layout0"     Screen      0  "Screen0"     Screen      1  "Screen1"     InputDevice    "Keyboard0" "CoreKeyboard"     InputDevice    "Mouse0" "CorePointer" EndSection  Section "Files" EndSection  Section "InputDevice"     # generated from default     Identifier     "Mouse0"     Driver         "mouse"     Option         "Protocol" "auto"     Option         "Device" "/dev/psaux"     Option         "Emulate3Buttons" "no"     Option         "ZAxisMapping" "4 5" EndSection  Section "InputDevice"     # generated from default     Identifier     "Keyboard0"     Driver         "kbd" EndSection  Section "Monitor"     Identifier     "Monitor0"     VendorName     "Unknown"     ModelName      "Unknown"     HorizSync       28.0 - 33.0     VertRefresh     43.0 - 72.0     Option         "DPMS" EndSection  Section "Device"     Identifier     "Device0"     Driver         "nvidia"     VendorName     "NVIDIA Corporation"     BoardName      "GeForce 210" EndSection  Section "Screen"     Identifier     "Screen0"     Device         "Device0"     Monitor        "Monitor0"     DefaultDepth    24     SubSection     "Display"         Depth       24     EndSubSection EndSection   Section "Monitor"     Identifier     "Monitor1"     VendorName     "Unknown"     ModelName      "Unknown"     HorizSync       28.0 - 33.0     VertRefresh     43.0 - 72.0     Option         "DPMS" EndSection  Section "Device"     Identifier     "Device1"     Driver         "intel"     VendorName     "Intel"     BoardName      "Internal Intel Graphics" EndSection  Section "Screen"     Identifier     "Screen1"     Device         "Device1"     Monitor        "Monitor1"     DefaultDepth    24     SubSection     "Display"         Depth       24     EndSubSection EndSection   But it is still not working.   Is this generally possible to use two different drivers in X ? Is it necessary to create an xorg.conf manually then? (because Ubuntu 12.10 normally works without the xorg.conf) Are there any errors in my xorg.conf? $ a\in \Bbb Z_n$ is invertible $\,\Rightarrow\gcd (a,n) =1$ Prove that $\frac{1}{\sin^2 z } = \sum\limits_{n= -\infty} ^ {+\infty} \frac{1}{(z-\pi n)^2} $ Proving that $f(x)$ is less than or equal to $1+\pi/4$ Suppose $f$ is a real valued differentiable function defined on $[1,\infty)$ with $f(1)=1$. Suppose also that $f$ satisfies $$f'(x)=\frac{1}{x^2+f^2(x)}.$$ The question is to prove that $f(x) \leq 1+\pi/4$ for every $x \geq 1$    I tried to solve the differential equation but could not bring it in some known form. I examined the derivative of $\tan^{-1}x$ which looks similar to that  in the question. However I could not get any idea with that. Any help shall be highly appreciated. Thanks. Difference between "speed up something" and "speed something up" Both seem to be in common usage, but is there a nuanced difference about when one is more appropriate than the other? Thanks. How do I parse an ISO 8601-formatted date? What is there to do after beating the Elite Four/Champion (Post-Game)? I've defeated the Elite Four and the Champion. The credits rolled and I've been teleported to my home in Vaniville Town. What is there to do now? Any specific events/features that are unlocked now?  I already know of and caught Mewtwo and Zyrgarde. What caused the apocalypse in the Hunger Games? So the stories of the Hunger Games are set in , a post-apocalyptic society situated in North America. Is there anything to explain what caused the Apocalypse? Whether from the main books, any extra material or interviews? (No fanfic please.)  As well as the cause, is there any indication of when the apocalypse happened? And how long after the apocalypse are the events of the Hunger Games? Objective-C: Use singleton vs. use class as an object? Optimization when Cost Function Slow to Evaluate Black artifacts when looking through many transparent objects? What lens focal length most closely resembles the perspective of the human eye? Prove $\frac{|a+b|}{1+|a+b|}<\frac{|a|}{1+|a|}+\frac{|b|}{1+|b|}$. Prove that for every $a, b\in R\setminus\{0\}$ is correct this inequality:  $$\frac{|a+b|}{1+|a+b|}&lt;\frac{|a|}{1+|a|}+\frac{|b|}{1+|b|}.$$ Old usernames stick to Community Wiki posts On a whim the other day, I changed my meta name from Lord Torgamus to Popular Demand.  I just noticed that the old name has "stuck" to the author tag of ; everywhere else on meta, my new name displays as expected.  Is this a feature?  Is it a bug?  Mostly I'm just curious, as I can't think of a strong reason in favor of keeping this behavior or a strong reason for changing it.  A question somewhat like this has been raised before as , but the previous poster implied that the issue had something to do with migration, which my situation shows is not the case. How can you smooth the edge between two materials? I have created this with cycles:  But the edge between the glowing and non glowing materials is very sharp. The material was manually applied to faces in edit mode. Is there any way I can smooth the edge between them in cycles? Why don't we treat rubbish the same as spam? How to prove that if A, B, C are submodules of M module then $$ A \cap (B+C) = (A\cap B)+C \iff C \subseteq A $$  Any help would be appreciated! Info Icon vs Question Mark Use induction to prove a product of sums of squares is a sum of squares