Turtles won't go back to home beach to lay eggs
Why aren't my turtles breeding?
String representation of an Enum I have the following enumeration:  public enum AuthenticationMethod {     FORMS = 1,     WINDOWSAUTHENTICATION = 2,     SINGLESIGNON = 3 }   The problem however is that I need the word "FORMS" when I ask for AuthenticationMethod.FORMS and not the id 1.  I have found the following solution for this problem ():  First I need to create a custom attribute called "StringValue":  public class StringValue : System.Attribute {     private readonly string _value;      public StringValue(string value)     {         _value = value;     }      public string Value     {         get { return _value; }     }  }   Then I can add this attribute to my enumerator:  public enum AuthenticationMethod {     [StringValue("FORMS")]     FORMS = 1,     [StringValue("WINDOWS")]     WINDOWSAUTHENTICATION = 2,     [StringValue("SSO")]     SINGLESIGNON = 3 }   And of course I need something to retrieve that StringValue:  public static class StringEnum {     public static string GetStringValue(Enum value)     {         string output = null;         Type type = value.GetType();          //Check first in our cached results...          //Look for our 'StringValueAttribute'           //in the field's custom attributes          FieldInfo fi = type.GetField(value.ToString());         StringValue[] attrs =            fi.GetCustomAttributes(typeof(StringValue),                                    false) as StringValue[];         if (attrs.Length &gt; 0)         {             output = attrs[0].Value;         }          return output;     } }   Good now I've got the tools to get a string value for an enumerator. I can then use it like this:  string valueOfAuthenticationMethod = StringEnum.GetStringValue(AuthenticationMethod.FORMS);   Okay now all of these work like a charm but I find it a whole lot of work. I was wondering if there is a better solution for this.  I also tried something with a dictionary and static properties but that wasn't better either. What is happening here, when I use squared loss in logistic regression setting? I am trying to use squared loss to do binary classification on a toy data set. I am using mtcars data set, use mile per gallon and weight to predict transmission type. The plot below shows the two types of transmission type data in different colors, and decision boundary generated by different loss function. The squared loss is $\sum_i (y_i-p_i)^2$ where $y_i$ is the ground truth label (0 or 1) and $p_i$ is the predicted probability $p_i=\text{Logit}^{-1}(\beta^Tx_i)$. In other words, I am replace logistic loss with squared loss in classification setting, other parts are the same. For a toy example with mtcars data, in many cases, I got a model &quot;similar&quot; to logistic regression (see following figure, with random seed 0).  But in somethings (if we do set.seed(1)), squared loss seems not working well.  What is happening here? The optimization does not converge? Logistic loss is easier to optimize comparing to squared loss? Any help would be appreciated.  Code d=mtcars[,c(&quot;am&quot;,&quot;mpg&quot;,&quot;wt&quot;)] plot(d$mpg,d$wt,col=factor(d$am)) lg_fit=glm(am~.,d, family = binomial()) abline(-lg_fit$coefficients[1]/lg_fit$coefficients[3],        -lg_fit$coefficients[2]/lg_fit$coefficients[3]) grid()  # sq loss lossSqOnBinary&lt;-function(x,y,w){   p=plogis(x %*% w)   return(sum((y-p)^2)) }  # this random seed is important for reproducing the problem set.seed(0)  x0=runif(3) x=as.matrix(cbind(1,d[,2:3])) y=d$am opt=optim(x0, lossSqOnBinary, method=&quot;BFGS&quot;, x=x,y=y)  abline(-opt$par[1]/opt$par[3],        -opt$par[2]/opt$par[3], lty=2) legend(25,5,c(&quot;logisitc loss&quot;,&quot;squared loss&quot;), lty=c(1,2)) Merge some tab-delimited files Intuition on the Kullback–Leibler (KL) Divergence I have learned about the intuition behind the KL Divergence as how much a model distribution function differs from the theoretical/true distribution of the data. The source I am reading goes on to say that the intuitive understanding of 'distance' between these two distributions is helpful, but should not be taken literally because for two distributions $P$ and $Q$, the KL Divergence is not symmetric in $P$ and $Q$.   I am not sure how to understand the last statement, or is this where the intuition of 'distance' breaks down?   I would appreciate a simple, but insightful example. Is there any way to do a correct word count of a LaTeX document? Often assignments (or even papers) have a word count limit. That is not a big deal when using Word, but I don't know how to do that using LaTeX. My solution has been so far to compile the document and then do a rough word count of my pdf file, sometimes even copying the contents of the pdf file and pasting in Word to get a mostly correct Word count.  Is there any tool (maybe even an online tool), package, script or software to do that directly from my .tex document and still get the right word count (i.e., ignore commands, equations, etc)? Polynomial contrasts for regression This question is about finding reasons for compile errors when using tikz.  Consider the files compiles.tex, compiles-not1.tex and compiles-not2.tex. Then it is clear that compiles-not1.tex does not compile, because the name C has not been assigned. The file compiles-not2.tex does not compile, because \draw (A) -- (A -| B ); contains a space after the name B. However, this is difficult to see from the error message.   Is it possible to tweak the error messages generated by tikz to perhaps mark tikz-code and names in some way? What I mean is that in the example, an error message ! Package pgf Error: No shape named 'B ' is known. might be more helpful, as the space in the name B\␣ (B with a trailing space) is more clearly delimited from the message.   File compiles.tex compiles without errors.  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}     \node (A) {A};     \node[above right of=A] (B) {B};     \draw (A) -- (A -| B); \end{tikzpicture} \end{document}   On compilation compiles-not1.tex generates ! Package pgf Error: No shape named C is known.  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}     \node (A) {A};     \node[above right of=A] (B) {B};     \draw (A) -- (A -| C); \end{tikzpicture} \end{document}   compiles-not2.tex generates ! Package pgf Error: No shape named B  is known.  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}     \node (A) {A};     \node[above right of=A] (B) {B};     \draw (A) -- (A -| B ); \end{tikzpicture} \end{document} How do I completely remove Ubuntu 12.04 on my Mac? I have dual booted Ubuntu 12.04 on my Mac using disk utility and the rEFIt tool.The battery life is very bad and therefore I want to switch back to Ubuntu 10.04 . How can I completely remove the 12.04 partition? How can i integrate one SFDC org to another SFDC using Rest Api I am trying to integrate one Salesforce org to other org by using Oauth setup, I wanted to use  use consumer key and consumer secret key in my REST class to connect with the org, after connection part completion, I want to access Get(), Put(), Post(), etc. Including the ability to set Oauth and Authorization headers needed for Salesforce Rest API calls.  Actually I'm new in REST implementation so can you please explain me by using code samples. Object glitching/dissapearing in render due to parenting problems I have completed my animation but I realised when I render it that one of the propellers blades starts to glitch. On some frames it is in shot and some it is out of shot and this is really strange. These 'blades' are both parented to the same 'propeller' and the 'propeller' is parented to the middle ball. I have baked the animation through so this shouldn't be a problem. These propellers are passive rigid bodies. I have tried to figure out this problem and I just can't get to a solution. I've never had it where a rigid body object glitches out like that in the rendered animation, it's almost like it's jumping, which on the render these frames show the object as invisible. The video attached will show.   If anyone has experienced problems like this or knows an answer to my dilemma that would be greatly appreciated, thanks! I am wondering if there is a modifier or tool that will essentially undo a subsurf or subdivide command. What kind of things can you take from a hotel? Hotels normally provide a big amount of sets (well, depending on the quality, but however, many!) that can help you feel more comfortable there.  So for example you can get towels, slippers, candies, pens, shampoos, shaving kits, sponges, ...  The same in the self-service breakfast: pastries, bread, ...  They are meant to be used during your stay. However, they can be provided in such an amount that there are some extra by the time you leave... and make you feel like taking some back home.  My general rule is to take those things that I used but didn't finish. However, sometimes I may be tempted to take the brand new stuff lying there before I close the door for the last time.  So the question that pops is: what kind of things is it correct to take from hotels and what is it not recommended? Else, what items may differ from country to country? Citing @inbook with biblatex: how to put authors/editors before book title? I have    iPhone 5 (with iOS 8.3) MacBook Pro Early 2013 (with OS X Yosemite 10.10.3) iPad Air (with iOS 8.3)   My iPhone is paired with the MacBook, so e.g when my phone rings, I can see it in my computer. But when I want to AirDrop photos from my iPhone the MacBook, then I can't see the MacBook in my iPhone AirDrop targets.  I can see the iPad, I can see my wife's iPhone, but not the MacBook.  On MacBook, I can see the iPad, my wife's phone and even my iPhone and I can drop to there, but not the other way around.  Before I started troubleshooting, the iPhone and MacBook were mutually invisible (I only saw iPad from both). After a while of trying things and sending files back and forth, my MacBook started to see the iPhone, but I did not manage to make it work from the other way. Still, the iPhone seems to be much "less" visible than the iPad - which I see almost instantly and always, the iPhone only seems to appear after a while.  Just to make it clear:   both iPhone and MBP have BT turned on both have AirDrop visibility set to Everyone   I would be glad for any suggestions to fix this - what settings to check, logs, whatever. Number of possible marriage arrangements if Marriage Condition is satisfied Suppose I have a set of $n$ boys and each subset of $1\leqslant k \leqslant n$ boys knows at least $k$ girls then this means that the set of boys $B$ satisfies the marriage condition.  I am doing an exercise from a Graph Theory book and it says we can show by induction on $n$ that the number of possible marriage arrangements is $\geqslant t!$ if every individual boy knows at least $t \leqslant n$ girls or there are $\geqslant t!/(t-n)!$ possible marriages if each individual boy knows at least $t&gt;n$ girls.   I am struggling to see how the induction hypothesis can be implemented to prove the $n+1$ case. When you swap from the $n$ to $n+1$ case the conditions change and I can't see the link between them.  Would anyone be able to point me in the right direction? Is there an ideal PWM frequency for DC brush motors? In C#, can I convert a string value to a string literal, the way I would see it in code? I would like to replace tabs, newlines, etc. with their escape sequences. If this code: Console.WriteLine(someString);  produces: Hello World!  I want this code: Console.WriteLine(ToLiteral(someString));  to produce: \tHello\r\n\tWorld!\r\n Right now, I have everything in a partition (except EFI system partition). How can I split the partition into two, one for / and one for /home?   How would you use parted to do that step by step?  How would you use gparted to do that step by step?  How would you use LVM to do that step by step?   One thing I am not sure of is that I can't just shrink the partition and create a second partition on the space that is freed by shrinking, because that doesn't move /home to the new partition.  Thanks.    $ sudo parted -l [sudo] password for t:  Model: ATA TOSHIBA MQ01ABF0 (scsi) Disk /dev/sda: 500GB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags:   Number  Start   End    Size   File system  Name                  Flags  1      1049kB  538MB  537MB  fat32        EFI System Partition  boot, esp  2      538MB   500GB  500GB  ext4  $ sudo df -h [sudo] password for t:  Filesystem      Size  Used Avail Use% Mounted on udev            1.7G     0  1.7G   0% /dev tmpfs           340M  1.4M  338M   1% /run /dev/sda2       457G  6.7G  428G   2% / tmpfs           1.7G   27M  1.7G   2% /dev/shm tmpfs           5.0M  4.0K  5.0M   1% /run/lock tmpfs           1.7G     0  1.7G   0% /sys/fs/cgroup /dev/sda1       511M  6.1M  505M   2% /boot/efi tmpfs           340M   20K  340M   1% /run/user/1000 tmpfs           340M     0  340M   0% /run/user/106 Why does shell Command Substitution gobble up a trailing newline char? Another question I am struggling with:  Let $f:\mathbb{R} \rightarrow \mathbb{R}$ be defined in a neighborhood of $a$ (except maybe $a$ itself) and suppose that, $\lim_{x \rightarrow a}\left(f(x)+\dfrac{1}{\left|f(x)\right|}\right)=0$. Find $\lim_{x \rightarrow a}f(x)$, and prove by definition, that this is indeed the limit.    Thank you all for your answers!!  But.. How can I prove by definition that this is indeed the limit? take $\epsilon&gt;0$, I have to show that there exists a $\delta&gt;0$ such that, $|x-a| \leq \delta$ implies $|f(x)+1| \leq \epsilon$. now, I do know that there exists an $\delta_1&gt;0$, such that $|f(x)+\frac{1}{|f(x)|}|&lt; \epsilon$.Or, $\frac{\epsilon}{k}$ for some constant $k$ But, how can I continue from there?