I have two class like this  public class excel: document{  }  public class pdf: document{  }   and a base class document.  I have an enum  public enum DocumentType{     excel = 1,     pdf = 2 }   I have a core class with a generic method implemented method  public class manager{      LoadFile&lt;T&gt; (Stream stream) where T: document{     ...     }  }   Can i call the loadfile method with a command like this  Type GetType(DocumentType documentType){     ... }  LoadFile&lt;GetType(DocumentType.excel)&gt;(myStream){     ... }   I want have a generic parameter created by the enum.  the error is      &lt; generic cannot be applied to operands of type 'method group'
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;()     {         //...     } }
Using Ubuntu 11.10, how do I format an external or USB drive? I don't find an option to 'format' when I right click. In the new version, the drives don't come up on the desktop, but instead come on the Launcher. Group theoretic meaning of natural isomorphisms between certain functors LaTeX doesn't recognize "et al." in the Bibliography I'm using Jabref to manage my Bibliography.  Sometimes, I put directly:     First Author et al.   when adding the article author's name in Jabref.  When compiling my .tex file, LaTeX doesn't recognize the et. al as more names. It takes it as a name/surname.  This is an example of a Bibliography entry in Jabref.  @ARTICLE{Wolf2003,     author = {Wolf, K.et al.},     title = {Compensation mechanism in tumor cell migration: mesenchymal–amoeboid     transition after blocking of pericellular proteolysis},     journal = {J. Cell Biol.},     year = {2003},     volume = {160},     pages = {267–277},    }   This is a .texMWE with the bib entry mentioned:  \documentclass[11pt]{book}   \usepackage{cite}   \bibliographystyle{unsrt} \begin{document}   Here is the bib entry mentioned\cite{Wolf2003}    \bibliography{bibfile}  \end{document}   Here's the output:   How can I solve this problem? How to show that $L^p$ spaces are nested? Suppose $1&lt;p_1&lt;p_2&lt;\infty$, then show $L^{p_1}[a,b] \supset L^{p_2}[a,b]$.  I was able to show $\|f\|_{p_1} \le \|f\|_{p_2} (b-a)^{1/p_1 - 1/p_2}$ but I'm not sure how to proceed from here. Is there a word to describe a highly desirable cursed treasure? Is there a single word to describe an object or idea that is so desirable that everyone wants to attain it but once they have it they are immediately cursed?  The idea is often used in literature—some examples:   In Lord of the Rings, the 'one ring' is a perfect example of this. In Guy de Maupassant's story , the necklace might be considered to be this. There are many stories of people making deals with the devil (see question: ), or being granted three wishes by a Djinn or fairy, which inevitably turn out bad. In the Twilight Zone episode , Bemis's desire to be left alone with his books would be an example of this word.   'Bane' covers the cursed part, but no one desires it.  Is there a single word to describe a most highly desired treasure that (knowingly or unknowingly) comes with a curse? Detecting outliers using standard deviations Following my question , I am wondering if there are strong views for or against the use of standard deviation to detect outliers (e.g. any datapoint that is more than 2 standard deviation is an outlier).  I know this is dependent on the context of the study, for instance a data point, 48kg, will certainly be an outlier in a study of babies' weight but not in a study of adults' weight.  Outliers are the result of a number of factors such as data entry mistakes. In my case, these processes are robust.   I guess the question I am asking is: Is using standard deviation a sound method for detecting outliers? Everything I've seen points to no (and I would love that to be true since applying for a visa online costs money) but I'm worried about getting refused due to the length of time I wish to stay, which is 6 months.  I went to university in the UK on a Tier 4 visa, but have never just been a tourist which is what I would like to do now. Since graduating, I have started working but am underwhelmed and would love to travel again. My original plan was Australia but now I would like to see the rest of the UK as well beforehand.  If I arrived with the following, would I be refused entry simply for not applying online?: an approved Australian work &amp; holiday visa, a mini itinerary, bank statements for the last 6 months. Proof : $2^{n-1}\mid n!$ if and only if $n$ is a power of $2$. I want to prove that:  $2^{n-1}\mid n!$ if and only if $n$ is a power of $2$. Where can I most efficiently buy all items for the "Shut up and take my money" achievement? "Results found containing ___" too close to header Solution  Full solution for producing PDF/X compliant document can be found in MWE and answer to this question:   Adapted MWE and compilation method are taken from Leonid's answer to this question.  Please note that solution requires compilation with TeXLive 2015 (or later).  Original question  I am trying to compile my source with XeLaTeX to produce PDF/X-1a:2001 compliant document. Getting PDF/X-1a:2001 is possible with pdfx package (while using up-to-date TeX distribution), but only when document is compiled with pdflatex.  Since I am using OTF and TTF fonts in my document, I have to use XeLaTeX to compile it. This is MWE:  \documentclass{book} \usepackage[x-1a1]{pdfx} \begin{document} Some text \end{document}   When I try to compile this document with MiKTeX's 2.9 xelatex I get following error and compilation halts:  ! Undefined control sequence. l.111 \pdfminorversion                       =4 %  assumed for PDF/A ;  options may change this for...  ?    Is there any way to compile PDF/X-1a:2001 with XeLaTeX, either using pdfx or different package?  Ps. I used MiKTeX 2.9, because I don't want to update my TeX Live 2013/Debian distribution I normally use. With MiKTeX I get most recent version of pdfx package.  EDIT: Since it isn't obvious from Leonid's answer and is mentioned only in comments, please note that you need TeXLive 2015 in order for Leonid's answer to work fully. TeXLive 2013 (installed by your system's package manager) or MiKTeX 2.9 won't do the trick (this is true as of March 2016; it might change by the time you read this).    I also tried to compile this MWE with LuaLaTeX to see if this works. It didn't. I get following error:  ! Undefined control sequence. \pdfx@findUUID ... \pdfx@tmpstring {\pdfmdfivesum                                                    {#1}} \expandafter \pdfx@e... l.360 \pdfx@findUUID{\jobname.pdf}  ?   In the event version of LuaLaTeX matters: lualatex --version outputs  This is LuaTeX, Version beta-0.76.0-2013062821  (MiKTeX 2.9 64-bit) (rev 4627) Beamer: Blackboard theme and overlays I am currently preparing my beamer presentation for my PhD defense.  I took the example at the url  to get a black board style presentation.  This template includes a short script which uses a random-generator to randomly scatter dust-trails on the black background to mimic chalk traces (see MWE below).  The thing is that parallel to that, I am also using overlays to uncover my slide layout by layout. The script is executed each time I am using a layout command which slows down the compilation quite substantially. I am not so familiar with control statements in latex, so here is my question:  How can-I modify this script for the background to be refreshed only when the slide is over, and not after each layout command?  Remarks:  1) I am using the Augie font, but I didn't included it in the MWE so that it can be compiled more easily  2) In case, it should make a difference I am also using the \begin{textblock*} \end{textblock*} environment from the textpos package to position text on the slide.  Here is my MWE:   \documentclass[10pt,mathserif]{beamer}  \usepackage[francais,english]{babel} \usepackage[utf8] {inputenc} %for ISOlatin1 (8859-1) sources \usepackage[T1] {fontenc}      %for polices DC 8bits   %%%Fancy fonts %\usepackage{emerald} %\usepackage{eulervm} %%%  %%Extra packages \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz} \usetikzlibrary{arrows,shapes} \usepackage[absolute,overlay]{textpos}    %set text colors for different objects \setbeamercolor{frametitle}{fg=white} \setbeamercolor{structure}{fg=white} \setbeamercolor{normal text}{fg=white} \setbeamercolor{alerted text}{fg=white} \setbeamercolor{example text}{fg=white}   %%Black background \setbeamercolor{background canvas}{bg=black}    %%%%%%%%%%%%%%%%%%%%%% %%%%%Script: Random Dust Trails%%%%%%%%%%%%%%% \pgfmathsetseed{\number\pdfrandomseed} % seed for random generator \setbeamertemplate{background}{     \begin{tikzpicture}         \useasboundingbox (0,0) rectangle (\the\paperwidth, \the\paperheight);        \foreach \i in {1,...,30} {             \pgfmathsetmacro{\x}{random(0,10000)/5000-1}%             \pgfmathsetmacro{\y}{random(0,10000)/10000-0.1}%             \pgfmathsetmacro{\r}{random(0,10000)/1000-5}%             \rotatebox{\r}{                 \pgftext[at=\pgfpoint{\x\paperwidth}{\y\paperheight}, left, base]{\includegraphics[width=\textwidth]{paintstroke.png}}             }         };      \end{tikzpicture} } %%%%%%%%%%%%%%%%%%%%%%  %%No navigation bar \setbeamertemplate{navigation symbols}{}  \begin{document}      \begin{frame}          \begin{itemize}             \item&lt;1-&gt; bla slide 1             \item&lt;2-&gt; blu slide 1             \item&lt;3-&gt; blub slide 1         \end{itemize}      \end{frame}  %%I want the background to be refreshed with the Dust Trails script only at the end of the frame          \begin{frame}          \begin{itemize}             \item&lt;1-&gt; bla slide 2             \item&lt;2-&gt; blu slide 2             \item&lt;3-&gt; blub slide 2         \end{itemize}      \end{frame}  \end{document}   This is my first post, so please be kind if I did something illegal on the formatting of the message ;-).  Thanks in advance,  Yannick Ways to give users some specific education about question quality and topicality Important: This question is being asked here, and not on the Programmers Meta,  because I believe that several SE sites suffer from this same, specific problem.    On Programmers, I see a pattern emerging.   New User sees the "Programmers" site title, and asks their incomplete, "fix my broken code" question. Community members comment that their question is off-topic, and recommend Stack Overflow.  New User says "thanks" and leaves, leaving their undeleted question for the community to clean up.    What seems clear to me is that:   New User has never seen the "What kinds of questions can I ask about here" page, or if they have, they've clicked through it without reading it. New User doesn't know how to move their question to the right place properly  (i.e. post on new site, delete from old site). Community cleanup of such questions is onerous.  The moderators on Programmers, following the principle that the community should moderate itself for the most part, are not proactive about removing such questions unless they're especially egregious. Migration is even more onerous.   OK, so we have the .  Here's what it says about topicality, about halfway down the page:    Note to those who are confused about Programmers' site scope: it's all right there, in black and white.  However, I do notice a problem.  It's circled in red.  That's our fault, the fault of the Programmers community.  What we really meant to say was "Don't ask your code troubleshooting questions here; those belong on Stack Overflow."  Coding tools deserves its own bullet.  We should fix that.  However, what are the chances that the user is actually seeing this, and evaluating whether or not they should ask their question based on this?  So here's my question, in two acts:  ACT I:  Is there a way to highlight the pain points of a particular site to new users specifically, so that we can be very clear that we don't want those questions that are clearly and unambiguously off-topic on our site, before they ask their question?  ACT II: Failing that, is there a way that we can fast-track the removal of such questions so that they no longer pollute our front page? One thing I liked about Mint was that the terminal would usually show two colors: everything from the left to the $ would be one color, and everything past the $ would be another.   Is there a way to have this setup with Ubuntu? Are PHP variables passed by value or by reference? Is it possible to check a bash script syntax without executing it?  Using Perl, I can run perl -c 'script name'. Is there any equivalent command for bash scripts? I need to get rid of the GNOME Desktop Environment which has been installed by default when I updated my pc from 15.10 to 16.04.  After a while, I found myself not only with GNOME DE, but also with Cinnamon alongside (in the login screen, I could choose at least five or six DE!)  Now I am using Unity, and I'm happy with that, and I successfully uninstalled Cinnamon, but now I'm afraid that after uninstalling GNOME I will mess up the Unity DE, since I see many packages running in unity with the packagename starting with gnome-... Would someone mind to help me? Thx in advance CASESAFEID() apex equivalent Is there any function in Apex which could emulate functionality of the  formula function? I'm trying to get 18-char Id variant from the standard one. How to prove that there exists a prime number between $n$ and $ n!$, for all $ n&gt; 2$?    ( gives a much better bound, but this question is about obtaining a self-contained proof.) Can I re-create deleted Gmail accounts? A long time ago, I created a Google mail account. I fell for a trap that was common back then (not sure how it is nowadays) and ended up with two Google accounts—one for Gmail (using the Gmail email address I would like to use) and one for everything else (using an email address at an external mail provider).  Hoping that I could associate my Gmail and my actual Google account, I deleted my Gmail account only to discover that deleted account names cannot be used again. So basically my old Gmail account along with the Google email address I would like to use is gone.  My main Google account got assigned a different Gmail account in the mean time.  Do you know if it is possible to re-use my preferred Gmail address? If possible, I would like to assign it to my main Google account. But I'd also be happy to have it as a second Google account, anything is better than the current situation.