I have a generic method   Foo&lt;T&gt;   I have a Type variable bar   Is it possible to achieve something like Foo&lt;bar&gt;  Visual Studio is expecting a type or namespace at the bar.
What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime?  Consider the following sample code - inside the Example() method, what's the most concise way to invoke GenericMethod&lt;T&gt;() using the Type stored in the myType variable?  public class Sample {     public void Example(string typeName)     {         Type myType = FindType(typeName);          // What goes here to call GenericMethod&lt;T&gt;()?         GenericMethod&lt;myType&gt;(); // This doesn't work          // What changes to call StaticMethod&lt;T&gt;()?         Sample.StaticMethod&lt;myType&gt;(); // This also doesn't work     }      public void GenericMethod&lt;T&gt;()     {         // ...     }      public static void StaticMethod&lt;T&gt;()     {         //...     } }
Send data from Lightning Web Component (LWC) to a Visualforce page I am adding an LWC component in visualforce and need to add a handler for an event fired in the LWC component on the visualforce page. When googling all I can find is examples of how to do this with aura component using application events. LWC controller: handleSearchClick() {              const searchinfo = {          shipper: this.shipper,         system: this.system,         product: this.product,         status: this.template.querySelector('c-lwc-multi-select').value(),         period: this.period       };     this.dispatchEvent(new CustomEvent(         'dosearch',          {             detail: { data:  searchinfo},             bubbles: true,             composed: true,         }     ));     console.log({ 'lwcNominationSearch searchinfo': searchinfo }); }  AURA app: &lt;aura:application extends=&quot;ltng:outApp&quot; access=&quot;GLOBAL&quot;&gt; &lt;aura:dependency resource=&quot;c:lwcNominationSearch&quot; /&gt; &lt;aura:dependency resource=&quot;markup://force:*&quot; type=&quot;EVENT&quot;/&gt; &lt;/aura:application&gt;  Visualforce: &lt;div id=&quot;rcontainer&quot;&gt; &lt;/div&gt;  &lt;script&gt;     $Lightning.use(&quot;c:NotificationSearch_ltngoutApp&quot;, function()     {         $Lightning.createComponent(         &quot;c:lwcNominationSearch&quot;,         {},         &quot;rcontainer&quot;,         function(cmp)         {             console.log('component created');              //$A.eventService.addHandler({ &quot;event&quot;: &quot;c:myEvent&quot;, &quot;handler&quot; : visualForceFunction})               $A.eventService.addHandler({                 event: 'dosearch',                 handler: function (event) {                          console.log(&quot;vf event success&quot;);                 }             });          });     }); &lt;/script&gt; Can it happen that the image of a functor is not a category? There are two different commands to incorporate another file into the source of some document, \input and \include. When should I use one or the other? What are the differences between them? Are there more things like them to be aware of? How do I watch a file for changes? On November 11, my American girlfriend flew over to the UK to visit me. She was detained and questioned, and refused entry under the belief she would not leave within those six months. This was due to her having no return flight booked, as we were going to wait until we were together in the UK to book a return flight for either herself, or both of us back to the USA once we decided what exact dates I would be able to travel. Lesson learned. A hard lesson, but we learned!  Anyway, they said although she'll flag up in the future, it won't be a straight ban from entering and she could even try to come back the next day if she so pleased, although it would be unwise if her circumstances had not changed.  Fast forward to December 18. She got herself a job in the States to prove she intends to leave at the end of her stay, and has since applied for a UK Standard Visitor Visa. She posted her documents off to New York earlier today.  Will they send her a letter back refusing to issue her a visa since, as an American citizen, she does not even need one? She wanted to get one to be safe as I told her not to fly to the UK even with return flights booked if she doesn't have a visa, as she risks being denied once again after a long flight. It's hard to get this information on the Internet, and some stories I read said that they were sent a letter back from the UK Embassy denying their visa simply because they don't need one in the first place - even after that person was denied entry.  We're in a bit of a pickle granted, so any help would be greatly appreciated.   Cheers. Does the alarm work when my phone is turned off? Will the alarm still go off if I turn off the phone before?  Example: when I have low battery, I have to go to sleep and wake up at X o'clock, and there is no charger around. Should I turn off the phone?   Note: If it makes any difference my phone is Galaxy S running froyo How to disable the skype ads (advertisement)? When is "seems to be" used instead of "seems"? The baby seems happy/comfortable. The baby seems to be happy/comfortable.   Are these both correct? If both are correct, what are the differences between them? How do I calculate the distance of an object in a photo? How can I get maximum DoF with no distance markers? I am aware of what hyperfocal distance is and the general principles behind it. However, most of the tutorials I have seen and read regarding it make use of lenses with focus distance indicators. Unfortunately, neither of my lenses (Nikkor 18-55mm &amp; 35mm f1.8) have indicators.  I have read that you can 'cheat' and simply focus a third of the way into the shot (which I have done previously simply by spot-focusing on the lowest focus point in my VF). I also assume you could pace out the distance and note an object to focus on when you get back to the camera (though that might be easier said than done).  Does anyone have any suggestions on how to achieve maximum sharpness from front to back without focus distance markers. A new lens is not an option; global economic crisis and all that! Is there some trick to burning a cd with the CD/DVD creator?    I'm installing k3b because that's a known entity.  What is this, and where is the "burn" button?  Help just tells me this is Nautilus 3.4.1, but I don't see a .  There's no option to burn in the Files menu, nor does clicking on the whitespace indicate an option to burn anything. Why is the copy-constructor argument const? I have 2 hard disks, on first I have installed win xp. I boot into xp and run setup of win7 and installed it on second hard disk. Now the problem is that win7 bootloader is installed on first harddisk, so if I remove the first harddisk, I cannot boot into win7.   How I can move / install bootloader of win7 on second hard disk? I would like a proof of the following result, given on .  For all square matrices $\mathbf{A}$ and column vectors $\mathbf{u}$ and $\mathbf{v}$ over some field $\mathbb{F}$, $$ \det(\mathbf{A}+\mathbf{uv}^\mathrm{T}) = \det(\mathbf{A}) + \mathbf{v}^\mathrm{T}\mathrm{adj}(\mathbf{A})\mathbf{u}, $$ where $\mathrm{adj}(\mathbf{A})$ is the adjugate matrix of $\mathbf{A}$.  Note that $\mathbf{A}$ may be singular. However, the proof given on wikipedia requires that $\mathbf{A}$ is nonsingular. Problem:  Let $A_{n.n}$ be square complex matrix. Prove the following: $$\left \| A \right \|=\left \| A \right \|_{HS}\Leftrightarrow  rank(A)\leqslant 1$$. Where $\left \| . \right \|_{HS} $ is the Hilbert Schmidt Norm.  Please read my solution and tell me whether it is correct. If not, let me know where the mistake is.  Proof of the implication $\Leftarrow $:   If $rank(A)=0$, then in this case $A=0$. It follows that $\left \| A \right \|=\left \| A \right \|_{HS}=0$ If $rank(A)=1$, than: $ A=\begin{pmatrix} A_{1}\\  \alpha _{2}A_{1}\\  ...\\  \alpha _{n}A_{1} \end{pmatrix}$ where $A_{1}$ is the first row of $A$   and in this case: $\left \| A \right \|=\left \| A \right \|_{HS}=\left \| A_{1} \right \|\sqrt{1+\alpha _{1}^{2}+...+\alpha _{n}^{2}}$  Proof of the implication $\Rightarrow $   We know that $\left \| A \right \|=max_{\left \| x \right \|=1}\left \| Ax \right \|$  On the other hand: $ A=\begin{pmatrix} A_{1}\\  A_{2}\\  ... \\ A_{n}  \end{pmatrix}$. So, $$\left \| Ax \right \|=\left \| \begin{pmatrix} \left \langle A_{1},x \right \rangle\\  \left \langle A_{2},x \right \rangle\\  ...\\   \left \langle A_{n},x \right \rangle\end{pmatrix} \right \|=\sqrt{\left \langle A_{1},x \right \rangle^{2}+\left \langle A_{2},x \right \rangle^{2}+...+\left \langle A_{n},x \right \rangle^{2}} $$  Where $ \left \langle A_{i},x \right \rangle$ is the inner product of $A_{i}$ and $x$  Using the Cauchy-Schwarz inequality: $\left \langle A_{i},x \right \rangle^{2}\leq \left \| A_{i} \right \|^{2}\left \| x \right \|^{2}$, we get: $\left \| A \right \|=max_{\left \| x \right \|=1}\left \| Ax \right \|\leq max_{\left \| x \right \|=1}\left \| x \right \|\left \| A \right \|_{HS}=\left \| A \right \|_{HS}$. In order to have the equality: $\left \| A \right \|=\left \| A \right \|_{HS}$, we should have: $\left \langle A_{i},x \right \rangle^{2}=\left \| A_{i} \right \|^{2}\left \| x \right \|^{2} $ which occurs only if $A_{i}=\lambda _{i} x$. So, the rows of A are dependent, which implies that $rank(A)=1$. Note that the case $rank(A)=0$ happens when $A=0$  Please let me know if my solution makes sense. Puzzling Enumerable.Cast InvalidCastException The following throws an InvalidCastException.  IEnumerable&lt;int&gt; list = new List&lt;int&gt;() { 1 }; IEnumerable&lt;long&gt; castedList = list.Cast&lt;long&gt;(); Console.WriteLine(castedList.First());   Why?  I'm using Visual Studio 2008 SP1. Test statistic for follow up procedure (stepwise step down) of Kruskal Wallis When conducting a Kruskall Wallis test, it is possible to follow up the procedure with a post hoc test, looking for homogeneous subsets. My question is which statistic is used to perform this procedure (e.g., is it Chi-Square, z, or the original H)? I think this is a basic question, but it's hard to wrap my head around. Let $X_1$ and $X_2$ be independent and identically distributed exponential random variables with rate $\lambda$. Let $S_2 = X_1 + X_2$.  Q: Show that $S_2$ has PDF $f_{S_2}(x) = \lambda^2 x \text{e}^{-\lambda x},\, x\ge 0$.  Note that if events occurred according to a Poisson Process (PP) with rate $\lambda$, $S_2$ would represent the time of the 2nd event.   Alternate approaches are appreciated. The approaches provided are commonly used when learning queueing theory &amp; stochastic processes.     Recall the Exponential distribution is a special case of the Gamma distribution (with shape parameter $1$). I've learned there is a more general version of this  that can be applied. I'm trying to figure out how to send all information that is normally identified in the /var/adm/message file on a Solaris system to a remote system.