public ClientApp_Detail GetHomeDetbyClientID_AppID(string clientid, long appId) {     ClientApp_Detail sp = null;      using (HelpDeskDataContext HDDC = Conn.GetContext())     {          sp = (from st in HDDC.ClientApp_Details where  st.ClientID == clientid &amp;&amp; st.AppID == appId &amp;&amp; st.IsDeleted != true select st).FirstOrDefault();      }      return sp; }   As I am a beginner to .NET, I am unable to understand the use of the above query and why it is declared as from st in.  Please explain the usage of such type query and what is returning to sp(example) variable.
What is LINQ? I know it's for databases, but what does it do?
How do you maximize the cycle count of your battery?  There seems to be a debate between:   Leave plugged in 24/7 but do a full cycle once a month Charge to ~100%, drain to ~10%, repeat.   NOTE: Taking your   Which method is better and why? How much of a difference does it really make?  Here are some of the better sources I've found about battery behavior so far. Even still I feel they don't conclusively answer the question above. See my elaborations below:           Elaborating on Option 1  Now IF Apple engineers were smart and optimized for AC draw when plugged in to not use up your charge cycles, then it seem logical to assume that you are using effectively none of your 1000 charge cycles while plugged in. If that's the case, it would seem that the LiPo drop from holding at 100% would be vastly outweighed by the fact you're not using any charge cycles.  However, this is a purely speculative assumption and I could find no evidence to either confirm or deny.  If this is NOT true, and the AC adapter only goes to charging the battery, then there would be no difference. Your battery would drain to 99%, then back up to 100%, then back down to 99%, etc. Those micro-charge cycles would add up at the same rate as 100% -> 0% -> 100%, and you would get no gain. In this case the negative effect of holding LiPo batteries at 100% would outweigh everything else.  Elaborating on Option 2  There are lots of good reasons why Option 2 is the way it is:   Because of known LiPo chemistry issues, holding a 100% charge for a long time causes the battery to degrade Apple specifically recommends not to leave it plugged in all the time  Draining a battery all the way to zero all the time is bad for the cell (Which is why ~10% is used) Heat is a killer, and when plugged in AND charging, you get extra heat that causes damage.   There are a couple reasons why I'm challenging Option 2:   It seems silly that the most intuitive use case for thousands of people that use their macs as primary computers is wrong. If the hypothesis in option 1 is true, you're just burning unnecessarily through your finite charge cycles. It's a pain to have to remember to keep plugging in and plugging out and be worried about whether or not your device is plugged in. How can I tell if an ETF is expensive? For stocks, I can easily look at the price/earnings ratio, and, according to The Intelligent Investor, stand clear of those with a ratio higher than 20.  How can I tell if the current price of an ETF is a good price to buy it? Are there such simple metrics? Add 'Page' above page numbers in Table of Contents I am using my school's latex . Unfortunately, since this package was last updated, we are now required to add the word 'Page' above the topmost page number on each page of the Table of Contents. This cls file includes the following bit of code, which puts 'Page' at the top of the first page, but not any subsequent pages (see attached)  \newcommand\chapteruaf{ \if@arabic\relax\else\if@chapterone\setcounter{page}{1}\else\relax\fi\fi \@chapteronefalse                     \if@openright\cleardoublepage\else\clearpage\fi                     \thispagestyle{myheadings}%                                                                                                    \global\@topnum\z@                     \@afterindentfalse                     \secdef\@chapter\@schapteruaf} \def\@schapteruaf#1{\if@twocolumn                    \@topnewpage[\@makeschapterheaduaf{#1}]%                                                                                     \else                    \@makeschapterheaduaf{#1}%                                                                                                     \@afterheading                  \fi} \def\@makeschapterheaduaf#1{%                                                                                                    {\parindent \z@ \centering     \reset@font     \normalsize \bfseries  #1\par                                                                                                  \vspace{-18.3pt}\hspace{143mm} Page                                                                                            \nobreak   }}   First page of the TOC:   second page of the TOC:   Any thoughts here? I have played with this a bit, and can't get it to work. Thanks. Backgrounder:  The  (Pointer to IMPLementation) is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of.  This hides internal implementation details and data from the user of the library.  When implementing this idiom why would you place the public methods on the pimpl class and not the public class since the public classes method implementations would be compiled into the library and the user only has the header file?  To illustrate, this code puts the Purr() implementation on the impl class and wraps it as well.  Why not implement Purr directly on the public class?  // header file: class Cat {     private:         class CatImpl;  // Not defined here         CatImpl *cat_;  // Handle      public:         Cat();            // Constructor         ~Cat();           // Destructor         // Other operations...         Purr(); };   // CPP file: #include "cat.h"  class Cat::CatImpl {     Purr(); ...     // The actual implementation can be anything };  Cat::Cat() {     cat_ = new CatImpl; }  Cat::~Cat() {     delete cat_; }  Cat::Purr(){ cat_-&gt;Purr(); } CatImpl::Purr(){    printf("purrrrrr"); } I am getting a warning when trying to include the .net 3.5 sp1 prerequisite for my setup project.  The warning states Prerequisite could not found for bootstrapping.  Any suggestions?  Thanks $f$ holomorphic on $D\setminus \{0\}$ and takes no values in $(-\infty,0],$ then $0$ removable If $f$ is holomorphic on $D\setminus \{0\}$ and takes no values in $(-\infty,0]$ then $0$ is a removable singularity.   I thought to prove this by elimination, but I can't really tell anything about the behavior of $f$ around $0$. How can one translate the information about the definition of $f$ in semi-open interval $(-\infty,0]$. Breaking of diffeomorphism invariance after fixing a background metric Change the height of a function being plotted Proof of $\int_0^\infty \left(\frac{\sin x}{x}\right)^2 \mathrm dx=\frac{\pi}{2}.$ How to tell what method was used to log in (Password vs. Keyfile) from the bashrc Is there a way how you can check what auth method the user which just logged in to an account were using?  I like to print out a warning after login if someone is using a password instead of a keyfile.  Sure one solution is to check the ssh-logs. But is there a nicer way to do this? Since looking up logs could impact performance depending on the log size and method you use to gather this information.  We are using SUSE and Ubuntu. dotted line with appropriate length for answering a question? Kindly have a look at this code   \documentclass{article} \usepackage{fontspec} \defaultfontfeatures{Ligatures=TeX} \usepackage[small,sf,bf]{titlesec}  \setromanfont{Georgia} \usepackage{amssymb}  \newcommand{\checkbox}{$\square$} \begin{document}  If appropriate \checkbox  . Why appropriate, specify? ........... If inappropriate \checkbox . Why inappropriate, specify? .............. If appropriate \checkbox . Why appropriate, specify? ...........\\ If inappropriate \checkbox . Why inappropriate, specify? ...........  \end{document}   How can I make a dotted like, of appropriate length so that it is depressed, fainter, has consistent length so that it occupies the remaining white space in the  line or has specified length. Significance of assumption in competition inequality questions Refer to the problem below (IMO 2009 Shortlist)     Let $a, b, c$ be positive real numbers such that $$\frac{1}{a} + \frac{1}{b} + \frac{1}{c} = a + b+ c$$   Prove that    $$\frac{1}{(2a+b+c)^2} + \frac{1}{(2a+b+c)^2} + \frac{1}{(2a+b+c)^2} \leqslant \frac{3}{16} $$    In the solution given by the  (Pg 16), it states that      Without loss of generality, we choose $$a +b+c = 1$$.    Thus, the problem becomes    $$ \frac{1}{(1 + a)^2} + \frac{1}{(1 + b)^2} +\frac{1}{(1 + b)^2} \leqslant \frac{3}{16}(\frac{1}{a} + \frac{1}{b} + \frac{1}{c})$$    Applying Jensen’s inequality to the function $$f(x) = \frac{x}{ (1+ x)^2}$$   ,which is concave for $0 ≤ x ≤ 2$   and increasing for $0 ≤ x ≤ 1$, we obtain   $$α \frac{a}{(1 + a)^2} + β \frac{b}{(1 + b)^2} + γ \frac{c}{(1 + c)^2} \leqslant (α + β + γ) \frac{A}{(1 + A)^2}$$   , where $A =\frac{αa + βb + γc}{α + β + γ}.$   Choosing $α = \frac{1}{a} , β =\frac{1}{b},$ and  $γ = \frac{1}{c}$   , we can apply the harmonic-arithmetic-mean inequality   $$A =\frac{3}{\frac{1}{a} + \frac{1}{b} + \frac{1}{c}} ≤ \frac{a + b + c }{3} = \frac{1}{3} &lt; 1$$   Finally we prove:   $$ \frac{1}{(1 + a)^2} + \frac{1}{(1 + b)^2} +\frac{1}{(1 + b)^2} \leqslant ( \frac{1}{a} + \frac{1}{b} + \frac{1}{c}) \frac{A}{(1 + A)^2} \leqslant ( \frac{1}{a} + \frac{1}{b} + \frac{1}{c})\frac{A}{(1 + \frac{1}{3})^2} = \frac{3}{16}(\frac{1}{a} + \frac{1}{b} + \frac{1}{c}) $$   However,  (Pg 4) differs by having $a +b+c=3$ and setting $f(x) = \frac{1}{16x} - \frac{1}{(x+3)^2}$ and allowing Jensen to resolve the rest.   The questions are as follows;   How do you choose before hand which $a + b+ c =$ to choose?  Why particularly does the assumption differ between the 2 solutions? How does one know before hand the choosing of $α = \frac{1}{a} , β =\frac{1}{b},$ and  $γ = \frac{1}{c}$?  Where and how did $A =\frac{αa + βb + γc}{α + β + γ}$ come from?   Any help would be much appreciated. How do I print all lines of a file with duplicate values in a certain column I have never had this problem before. But after seeing some questions posted on ELU, I started to doubt. I have been through links1, pages of grammar books2, a lot of questions3 posted here and ELU. I now still can't seem to understand how the past perfect is exactly used. The references sometimes even contradict each other.  What I had understood so far was      The past perfect is not necessary if we are not 'going back' to the earlier past, and simply moving from one event to another.   but I then saw a lot of other 'rules' including      If the sequence is clear, the past perfect is not needed.   which is slightly different, less 'narrow' and can be applied in more situations than the first ruleA, and      The past perfect is optional only when talking about an action at a specific time.   This is confusing. Can anyone here clarify things out please?    A For example, for  Doing the survey [completed] -&gt; Showing the result      We showed the result of the survey we did.      If the second rule is applied, the sentence above is fine (the sequence is clear), but not if the first rule since we are not moving from any event to the next and possibly even going back.    1  and   2 Practical English Usage (2005) by Michael Swan, Collins Cobuild Student's Grammar (1991). Upper-Intermediate Cutting Edge.  3 including , , ,  etc. Is voting to balance in the spirit of the site? The other day I saw an answer which was ok. Not great but not bad. So no reason to upvote or downvote. However the answer already had a single downvote. I felt this was unfair so upvoted the answer to keep it at what I felt was a fair score. It wasn't until afterward that it occurred to me that I should have perhaps solely voted on the content of the answer.  Is this a reasonable reason for an upvote or should I have left the answer alone? Product and sum of positive operators is positive I want to show that for $S,T\in B(H)$ bounded operators on Hilbertspace with $S\geq 0,T\geq 0$ and $ST=TS$,  we have $S+T\geq 0$, and $ST\geq 0$.  $T\geq 0$ means $(Tx,x)\geq 0$.    To me it seems that $((S+T)x,x) = (Sx,x)+(Tx,x)\geq 0$. But for $ST$ i like some help.   There is a theorem in Rudin (12.32) that says that for every $T\in B(H)$ we have an equivalence:   $T$ is positive $\Leftrightarrow$ $T$ is self adjoint, i.e. $T=T^*$ and $\sigma(T)\subset [0,\infty)$.   Since $S, T$ are self adjoint we know that $ST=TS = S^*T^* = T^*S^*$ ($ST$ is selfadjoint since $S,T$ commute). Also I read somewhere that if $S,T $ commute then $\sigma(ST)\subset \sigma(S)\sigma(T)$, but I am not sure if this is true. Clearly I cant prove it, but if it were true by this ''Theorem'' it would follow that $ST \geq 0$.   Is there a more straightforward way? Difference between "while" and "whilst" Possible Duplicate:          In terms of construction of sentences, can the two words while and whilst be used interchangeably? Quantum entanglement faster than speed of light? What lies beyond the Sedenions 301 redirect instead of 404 when URL is a prefix of a post or page name? hey all! i have an odd problem with URL routing. when i request a URL that doesn't exist, e.g. , wordpress correctly returns a 404. however, if that URL is a prefix of a post or page name, it instead returns a 301 redirect to the post or page.  for example, if i have a post on 10/1/2010 named Food Post, it will return a 301 with Location:  (my permalink structure). likewise, if i have a page named Food Page, it will return a 301 with Location: .  you can see this in action on my live site,  . e.g.  redirects to  .  turning off permalinks (ie switching to "default") fixes it, for both posts and pages, but naturally i don't really want to do that.  i see this on three different installations, all wordpress 3.0.1 and apache 2.2, two ubuntu lucid/mysql 5.1 and one freebsd 7.3/mysql 5.0. i've deactivated all plugins and removed everything from my .htaccess except the lines for wordpress below, verbatim, but no luck.  RewriteEngine On RewriteBase / RewriteRule ^wordpress/index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L]   thanks in advance...