I'm currently trying to write an extension method to work out the allowed variance for a decimal. While I was writing it I thought I'd extend it to a generic extension, with restrictions to decimal, float, double.  Currently I'm not aware of how (or if it's possible) to restrict a generic to value types.  public static bool WithinVariance(this decimal source, decimal allowedVariance, decimal comparisonValue)         =&gt; WithinVariance&lt;decimal&gt;(source, allowedVariance, comparisonValue);  public static bool WithinVariance&lt;T&gt;(T source, T allowedVariance, T comparisonValue)     // where T : decimal     // where T : double     // where T : float  {     var allowedDifference = (source / 100) * allowedVariance;     var difference = source - comparisonValue;     return Math.Abs(difference) &lt;= allowedDifference; }   The above code doesn't work, it's there purely to show the approach I'm taking. Originally I was just going to a single method, but I changed to the above to try to hack it into working. Also an attempt at restricting the extension methods without using a where t filter (see commented out lines)  Does anyone know if it's possible and if so how to do this?
Can anyone tell me if there is a way with generics to limit a generic type argument T to only:   Int16 Int32 Int64 UInt16 UInt32 UInt64   I'm aware of the where keyword, but can't find an interface for only these types,  Something like:  static bool IntegerFunction&lt;T&gt;(T value) where T : INumeric
How do I make a bootable USB OS X installer on a Mac? Does anyone have a Terminal command-line recipe for making a new bootable USB flash drive for one of the new MacBook Air's?  Is there a way to dd copy the USB boot device that comes in the box and make the new copy bootable?  I'd like to make a new backup copy of the USB rescue device for my MBA, preferably on a much larger flash drive with room for a backup of some of my working directories.  Added:  And is it possible to make, not just a rescue drive, but a bootable USB drive that will boot a fully updated version of the OS (say 10.6.8 or later)?  If so how on a MacBook Air 11, and how big a USB stick will this require? Dual Canadian and British citizen - healthcare coverage in the UK? Regular Expression to match valid dates I've ran out of chocolate bars and didn't realize I could enchant my giant spoon and knight's armor. Is there any way to get more reliably? How can I set up password-less SSH login? How to handle ordinal categorical variable as independent variable I am using a logit model. My dependent variable is binary. However I have an independent variable which is categorical and contains the responses: 1.very good, 2.good, 3.average, 4.poor and 5.very poor. So, it is ordinal ("quantitative categorical"). I am not sure how to handle this in the model. I am using gretl.  [Note from @ttnphns: Although the question says the model is logit (because the dependent is categorical), the crucial issue - ordinal independent variables - is basically alike, be the dependent categorical or quantitative. Therefore the question is equally relevant to, say, linear regression too - as it is to logistic regression or other logit model.] Total space of a finite rank locally free sheaf, Vakil's 17.1.4 & 17.1.G Has a double slit experiment ever been done using a track chamber or even contemplated? I tried searches and the question has been posed in other fora, but no experiment came up.   Track chambers (cloud chambers, bubble chambers , time projection chambers, solid state detectors like the vertex detectors at LHC)  give the track of the particle as it ionizes the  medium, and could be carried out in geometry after the particle has passed the double slit. The straight track should be pointing back to the slit it came from and its record could be used as the points on the screen in the classical double slit experiment.  The set up as I see it would be the classical setup for single electron through the double slits but instead of a "screen" one has a detector and detects the track.  It should be a long enough detector to get an accuracy less than the slit difference so it could point back to the slit, as the interslit distance is of the order of 100 microns and detectors are giving order of microns accuracies.  This experiment, if possible,  would resolve the controversy whether the detection of the slit destroys the interference pattern or the  at the slits change the boundary conditions and destroy the interference pattern.  An expert's opinion is necessary whether the experiment is possible, whether the energies of the electrons to show interference with a specific d separation is enough to create an accurate track in a solid state detector. If not a cloud chamber would do , but again the energy of the electron would be important because it would have to pass the barrier air/chamber.  It could succeed if the double slits were within a cloud/ bubble chamber; the beam count was low  (10 to twelve per picture) but it was spread in the vertical direction. If the beam could be focused on the slits , it should be doable. It's easy to set inline CSS values with javascript. If I want to change the width and I have html like this:  &lt;div style="width: 10px"&gt;&lt;/div&gt;   All I need to do is:  document.getElementById('id').style.width = value;   It will change the inline stylesheet values. Normally this isn't a problem, because the inline style overrides the stylesheet. Example:  &lt;style&gt;    #tId {       width: 50%;    } &lt;/style&gt;  &lt;div id="tId"&gt;&lt;/div&gt;   Using this Javascript:  document.getElementById('tId').style.width = "30%";   I get the following:  &lt;style&gt;    #tId {       width: 50%;    } &lt;/style&gt;  &lt;div id="tId" style="width: 30%";&gt;&lt;/div&gt;   This is a problem, because not only do I not want to change inline values, If I look for the width before I set it, when I have:  &lt;div id="tId"&gt;&lt;/div&gt;   The value returned is Null, so if I have Javascript that needs to know the width of something to do some logic (I increase the width by 1%, not to a specific value), getting back Null when I expect the string "50%" doesn't really work.  So my question: I have values in a CSS style that are not located inline, how can I get these values? How can I modify the style instead of the inline values, given an id? Let $D \subset \mathbb{C}$ be the open unit disk, $f:D \to \mathbb{C}$ a holomorphic function and $d=\sup \{|f(z)-f(w)|:z,w\in D \}$. How can I show that $|f'(0)|\leq \frac{d}{2}$?  I tried using Schwarz's lemma on the function $g:D \to \mathbb{C}$ defined by $g(z)=\frac{f(z)-f(0)}{d}$, but I am only getting $|f'(0)|\leq d$. Using k-fold cross-validation for time-series model selection Question: I want to be sure of something, is the use of k-fold cross-validation with time series is straightforward, or does one need to pay special attention before using it?   Background: I'm modeling a time series of 6 year (with semi-markov chain), with a data sample every 5 min. To compare several models, I'm using a 6-fold cross-validation by separating the data in 6 year, so my training sets (to calculate the parameters) have a length of 5 years, and the test sets have a length of 1 year. I'm not taking into account the time order, so my different sets are :   fold 1 : training [1 2 3 4 5], test [6] fold 2 : training [1 2 3 4 6], test [5] fold 3 : training [1 2 3 5 6], test [4] fold 4 : training [1 2 4 5 6], test [3] fold 5 : training [1 3 4 5 6], test [2] fold 6 : training [2 3 4 5 6], test [1].   I'm making the hypothesis that each year are independent from each other. How can I verify that? Is there any reference showing the applicability of k-fold cross-validation with time series. I use Cygwin on my laptop (DOS). I have a collection of scripts from my colleagues, and my own. I am not an IT person, not knowledgeable in Unix. I am following my colleagues' syntax and able to manage a few simple things. The scripts worked well on my old laptop. I just changed laptop and installed Cygwin. When I run my scripts, they do not work. Here is one example of the error message I get: line 1: $':\r': command not found line 5: syntax error near unexpected token `$'\r'' line 5: `fi  Here are the top 5 lines of my script : iter=1 if [ -f iter.txt ]    then rm ./iter.txt  fi    Can someone please explain how I can get around this problem? How can I determine if a used game is pirated? I notice that the space between each column of a table in LaTeX is not quite wide (at least for me). Is there any way to set this? I found the \hspace, but I don't get how to use this in the table. I'm new to field extensions and I can neither see why or how to prove this statement.  If I'm not mistaken, to construct a splitting field, you construct rupture fields one after the other, using that the $8$ element field is the splitting field of $X^8-X$ over $\mathbb F_2$, since $2$ is the only prime divisor of 8.  Over $\mathbb F_2$ $X^8-X$ has two roots : $0$ and $1$. Therefore $X^8-X=X(X-1)(1+X+...+X^6)$. The last factor, call it $P$, has no roots. So let $\alpha$ be a root in some extension $\mathbb F_2(\alpha)$ of $\mathbb F_2$.  We now have $P=(X-\alpha)(X^5+\alpha X^4+...+\alpha^4X+\alpha^5)$.  I suspect $\alpha$ might not be the way to go and if so, my second plan would be to reduce $P$. I don't know how to do this but assuming it to be done, hence having $P=P_1...P_n$, I could start using $P_1$'s rupture field, and then my best guess is that if $\mathbb F_2[X]/(P_1)$ is not sufficient, I re-reduce $P$ over this new field and consider the rupture field of one of the factors, and so on.  Now assuming I wasn't given the statement itself, is it elementary to construct the $8$ element field using $\mathbb F_2$ ? How to use Terminal to delete all .svn folders recursively? What command can I type into the Terminal so that I can delete all .svn folders within a folder (and from all subdirectories) but not delete anything else? Just recently, the right-click context menus in Windows 7 have been acting in a kind of left-handed way. That is, when possible, the initial menu appears to the left of the mouse pointer. When I hover over a submenu option, the next level of context menu appears to the left of the first and so-on.  Basically, what normally happens when you're right at the right-hand edge of the screen is happening all the time - except when I'm at the left-hand edge. Perhaps it's some kind of left-handed users option, but that doesn't seem likely - more like a right-to-left language option, except that I've never even tried to use a right-to-left language.  I haven't checked every app. for the issue - probably only Windows Explorer, definitely not in Firefox, for the moment that's as far as I've checked.  Scratch that - this affects menu bars as well as context menus. The menus dangle down to the left of the menu-bar item instead of the right, and submenus open to the left too. This seems to apply to most applications, but not too Firefox or Thunderbird.  I find this extremely annoying.  I have no idea how this occurred, though it isn't the only weird glitch I've had in Windows 7 in the last few days - see   I assume there's a setting somewhere that has got changed, but I can't find anything. There's also a chance that I've suffered some kind of registry corruption, so I might need to apply a fix in the registry - not something that scares me, but I need to know what to fix and how.  So - does anyone know what setting has been changed, and how I can fix it?  Also, beyond CCleaner (which I already have), are there any tips on making sure that the registry stays clean and sane?  Finally, both Microsoft Security Essentials and Malwarebytes Antimalware seem happy that I don't have a malware problem. Should my recent glitches make me doubt that? Systems of linear differential equations - eigenvectors Missing abstract with amsart class I'm not very good at LaTeX but I've been using it to write my dissertation. Have just come to the end and trying to format everything correctly. Whenever I try to put my Abstract paragraph into the form \begin{abstract} (writing here) \end{abstract} and click play the whole abstract section just disappears. What am I doing wrong?  \documentclass[12pt]{amsart}  \begin{document}  \begin{abstract} (my abstract here) \end{abstract} \end{document} I have two given names and one surname. Is it a problem if I omit the surname from my ticket? I have two names as my given name in the passport and I typically just use this as my first and last name. However, my passport has a surname too which I almost never use. Due to this, I mistakenly provided my given name as first and last name.   As per the passport,  Surname : AAAA Given name(s) : BBBB CCCC   In the ticket, First name : BBBB Last name : CCCC  The credit card I've used to make this booking has my name as BBBB CCCC.  Will this create a problem at the travel time?  Update : the airline says that they can't update the name in the ticket. They are saying that since they have made a remark of the passport details boarding will not be a problem but I might face problems at immigration. Do they check name details in itenerary to exactly match passport at the time of immigration? Is that true in your experience?  Update : Travelled without any problem, neither at boarding gate, immigration nor after arrival at border police control.