I'm working on a database abstaction for mongodb in .NET Core 2.1. For this I use the mongo driver from Nu-Get.   Now I'm working on a simple generic extension method to include referenced objects in a similar way like other database abstractions for relational databases do that.  The following example shows how I plan to get a customer collection and include the  related job offers:  //get the customer collection and include the related job offers var result = Database.Customers.Find(x =&gt; x.Id != null).Include(x =&gt; x.JobOffers);   And this is the code of the Include extension method:  public static IList&lt;T&gt; Include&lt;T&gt;(this IFindFluent&lt;T, T&gt; result, Expression&lt;Func&lt;T, object&gt;&gt; filter)     {         var propertyName = filter.Body.ToString().Split(".")[1];         var idFieldName = typeof(T).Name.Substring(0, typeof(T).Name.Length) + "Id";          var list = new List&lt;T&gt;();         foreach (dynamic item in result.ToList())         {             try             {                 var type = item.GetType().GetProperty(propertyName).PropertyType.GenericTypeArguments[0];                 var builder = Builders&lt;JobOffer&gt;.Filter;                 var queryFilter = builder.Eq(idFieldName, (string)item.Id);                 var prop = item.GetType().GetProperty(propertyName);                  var relatedItems = _database.GetCollection&lt;JobOffer&gt;(propertyName).Find(queryFilter).ToList();                 prop.SetValue(item, relatedItems);              }             catch (Exception e)             {              }             list.Add(item);          }         return list;     }   So far it works but as it is now it just works for the object with the type JobOffers and it should work for any type of objects.   So my Question is: In the try {} section there is a variable type where the needed class is stored as Type.  How can I use this type in the angle brackets? I 'd like to do something like this:  var type = item.GetType().GetProperty(propertyName).PropertyType.GenericTypeArguments[0]; var builder = Builders&lt;type&gt;.Filter; var relatedItems = _database.GetCollection&lt;type&gt;(propertyName).Find(queryFilter).ToList();   But I get the error: type is a variable but is used as a type.  How am I suppost to solve this?
I have a string variable that represents the name of a custom class. Example:   string s = "Customer";   I will need to create an arraylist of customers. So, the syntax needed is:  List&lt;Customer&gt; cust = new ..    How do I convert the string s to be able to create this arraylist on runtime?
Why does $A\sin{k(x+c)}=a\sin{kx}+b\cos{kx}$ imply that $A=\sqrt{a^2+b^2}$ and $\tan{c}=-b/a$? I don't understand this. These identities are given in the online notes for MIT's 18.01 calculus class. It's related to taking the sum of two trig functions and transforming them into a single trig function. I can use the formulas to do this, but I am having trouble finding anything on the internet to use a proof for my understanding.  Thanks for any responses!  EDITED (added after the first answer):  Sorry, the identity goes like this:  $A\sin{k(x-c)}=a\sin{kx}+b\cos{kx}$ ,  with the relationships  $a=A\cos{kc}$ , $b=-A\sin{kc}$ , $A=\sqrt{a^2+b^2}$ , and $\tan{kc}=-b/a$ Formal writing: "…for my colleagues and {I/me/myself}."? I'm currently using Cambridge English Advanced 1. It's a book that contains past examination papers, and includes numerous samples of authentic writing. This material helps, candidates and teachers, understand what the examiners are ‘testing’ and how these papers are marked. The assessment covers four categories: content, communicative achievement, organisation and language. Each category is awarded a mark between 1 and 5, so the maximum score is 20, and each mark has a brief note attached by the examiner. Any errors of punctuation, orthography, grammar, appropriacy, and vocabulary are left intact. In fact, there are no corrections because the  ‘examiner’ does not specify where the errors lie. This can be frustrating, even though spelling mistakes are rare at the advanced level, and errors in style, collocation or register are still relatively easy to identify, sometimes I'll read a phrase that forces me to ponder.  Dear Director, [ TEXT ] To conclude, this letter is a polite request to cover the costs of a 2 month language course for my colleagues and me. We would be very pleased if the company would do us this favour. Yours sincerely John Smith  The following marks were awarded Content                    5    blah, blah, … Communicative Achievement  2    blah, blah, …     Organisation               3    blah, blah, … Language                   3    blah, blah, …  I am able to pick out six minor errors in that brief extract, maybe some users will identify more, maybe some will identify fewer, and maybe some will say that the language used is perfectly acceptable. But if I can help a candidate attain that elusive B,  I would be delighted. I am interested in (what could be) the 7th error, emphasised in bold. Because the letter of proposal is formal, I feel the phrase, for my colleagues and me, is jarring. I want to change it to for my colleagues and I, but the antecedent requires an object. You would not say: “This is a request to cover the cost […] for I”. So, why use the subject pronoun I in the expression “my colleagues and…”?  Could I use instead, myself?  Which of the following is preferable in a formal written proposal?    …for my colleagues and me …for my colleagues and I …for my colleagues and myself  EDITED: I found a   of the writing sample (11/11) if anyone is interested.  I've looked at the following question,  Some answers appear to be contradictory, the accepted answer says using  I and me are both grammatical, which in my example is not true. Moreover, there's no mention of myself, as a possible solution, in the question. There does not exist group $G$ such that Aut$(G)\cong \mathbb{Z}_n$ (for odd $n$) Prove existence of a real root. Series rearrangement and Riemann's theorem I think understand that when I have a conditionally convergent series, it consists of series of positive and negative values which are divergent and thus one can find such permutation of indices $\phi : \mathbb{N}\rightarrow\mathbb{N}$ so the rearranged series sums up to an arbitrary value, diverges or oscillates.   This is how I understand what Riemann's rearrangement theorem says, but how do I use it practically? For example, when I have the conditionally convergent series:  $$\sum_{n=1}^{\infty}\frac{(-1)^n}{\sqrt{n}}$$  and I want to rearrange it to be divergent or to sum up to certain value M? How do I define such bijections $\phi$ ?  I appreciate all help. LaTeXiT is cropping the pdf I am using LaTeXiT (pierre chachatelier, www.chachatelier.fr) - latex equation editor for Powerpoint for mac.  It's producing pdf that appear to be "cropped" on top (see attached) - I've tried already with changing the "margins" option (Preferences>General) but unsuccessfully - don't think that's the problem.   Any hint?   Thanks Long-distance Mind Trick In the Star Wars universe, could a Jedi Mind Trick be performed over the telephone?   For instance, could Yoda have called up the Imperial embassy on Dagobah and mind tricked whoever answered into getting him in touch with Palpatine? (I know there's no embassy or telephones on Dagobah, but serious question nonetheless.)   To clarify, are long distance mind tricks not only possible but would being in communication with another person, through telecommunication, allow a force user to better perform the action? When should titles like "captain" or "admiral" be capitalized? Please excuse the contrived example below, but I am wondering if this example is properly capitalised? I'm assuming that capitals are used when addressing someone directly, but lower case is used elsewhere. Can someone give some rules on this?      The captain walked into the room.    "Hi, Captain," said the admiral.   "Hi, Sir," replied the captain.   "Call me Admiral."   "Hi Admiral."   The captain and admiral stepped forward.   "Prime Minister, this is Captain Jones," said Admiral Brown.   "Pleased to meet you," said the prime minister. I have a ~23000 line SQL dump containing several databases worth of data. I need to extract a certain section of this file (i.e. the data for a single database) and place it in a new file. I know both the start and end line numbers of the data that I want.  Does anyone know a Unix command (or series of commands) to extract all lines from a file between say line 16224 and 16482 and then redirect them into a new file? Booting from USB and not installing I created a live usb to boot Kubuntu, which has worked well enough. However, when the installation gets to the point of telling me to restart the computer (and it restarts) the installation window pops up again, and the computer is still signed in as a live user. None of the installation or settings appear to have saved.  Any ideas? I will be getting a point-and-shoot camera for taking portraits and only portraits.  Specifically portraits with a shallow depth of field.   Groups portraits sometimes.  It's just too much work to add lens blur at post-prod.  I understand that setting a P&amp;S on macro mode gives a shallow focus and DOF.    How do I read P&amp;S camera specs to shortlist those with the shallowest depth of field?   Added: By point-and-shoot, I mean a camera that is easy to use -- Not necessarily compact, inexpensive, or current.  Also, if there are two or three factors/specs to get a shallow depth of field, then which spec contributes the most to bokeh? which is second most contributing? the third, etc.? Getting a vector into a function that expects a vector Is it possible to double your proficiency bonus twice? Let's say I'm a multiclass rogue/ranger and I have taken Expertise in survival checks. Now, if a ranger is in their favored terrain it says they double their proficiency bonus in intelligence and wisdom checks relating to you environment. If I am in my favored terrain and use my already doubled survival check, will it double again? Placing listing and figure side by side in memoir I know  that uses $x={\sqrt{2}}^{\sqrt{2}}$ to prove that there must exist an irrational to an irrational power that evaluates to a rational. But I don't know if $x$ itself is known to be irrational or rational.  Could someone enlighten me? Thanks! I have named him/he who shall not be named. Which of these is correct? I think it should be "him" because "him" is a direct object in this context. In this context, "him/he who shall not be named" is not a proper noun. $\sum_{n=1}^\infty\frac{z^n}{n}$ does not converge uniformly on $\mathbb{D}$. How to combine measurement error with statistic error We have to measure a period of an oscillation. We are to take the time it takes for 50 oscillations multiple times.  I know that I will have a $\Delta t = 0.1 \, \mathrm s$ because of my reaction time. If I now measure, say 40, 41 and 39 seconds in three runs, I will also have standard deviation of 1.  What is the total error then? Do I add them up, like so?  $$\sqrt{1^2 + 0.1^2}$$  Or is it just the 1 and I discard the (systematic?) error of my reaction time?  I wonder if I measure a huge number of times, the standard deviation should become tiny compared to my reaction time. Is the lower bound 0 or is it my reaction time with 0.1? Square roots of integers and cyclotomic fields For every $ N \in \mathbb Z$ there exists an integer $n$ such that $ \sqrt N \in \mathbb Q(\zeta_n)$.   I am struggling where to start this question, please suggest me few hints. "Reality" of EM waves vs. wavefunction of individual photons - why not treat the wave function as equally "Real"? In thinking how to ask this question (somewhat) succinctly, I keep coming back to a Microwave Oven.  A Microwave Oven has a grid of holes over the window specifically designed to be smaller in diameter than the wavelength of the microwaves it produces, yet larger than the wavelengths of the visible light spectrum - this is so you can watch your food being heated without getting an eye full of microwaves.  The "realness" of electromagnetic waves seems indisputable - both from the microwave example above, and also because if I want to broadcast a radio wave with a certain wavelength, then I need to make sure I have an antenna of corresponding length to produce the wave I'm looking for.  Furthermore, we discuss and treat these waves as real, measurable "objects" that exist and can be manipulated.     Now, if I want to describe the behavior of my Microwave Oven in the framework of QM (let's pretend my oven is going to only produce 1 photon of energy corresponding to a wavelength of the microwave spectrum for simplicity) then I'll describe the behavior of that photon as a wavefunction that evolves over time and gives a probability distribution within my microwave that similarly does not allow the photon to pass through the safety grid and exit the oven cavity giving me a retinal burn.  The difference is, the wavefunction is never treated as something "real" in this description.  When the safety grid is described as working to protect you because it has holes smaller than the wavelength of the classical waves it's blocking, this is a useful description that seems to describe "real" objects/be-ables.  While it is possible to describe why an individual photon has low probability of passing through the same grid but extended physical properties such as wavelength (in space) are treated as non-real because we're dealing with a point particle and with behavior described by something we also treat as non-real (the wavefunction); it seems unclear to me why we insist this wave function which predicts behavior of physical measurements so well is somehow "non-real."    Put another way, if we have no problem treating EM waves as "Real," then why do we insist on treating the wavefunction that describes the same behavior as "unreal?"  I understand there is recent research (Eric Cavalcanti and his group for one) trying to argue this point, but as every respectable physics professor, I've ever encountered, has treated the wavefunction as an indisputably non-real mathematical tool, I needed to ask this community for an answer.