In Python 3, how do I round a floating point number up to a certain decimal place?
round() doesn't seem to be rounding properly
Does the command pwd in a shell script output the directory the shell script is in? I wrote a simple backup script which back ups my stuff on a remote server, everything is working great but I'd like to have some sort of report like "backup successful or not".  this is my script   # backup CHECK date1=`date +"%d.%m.%y - %H.%M"` host=`hostname` twdate=`date +"%d.%m"` performtw=`ls -la|grep "tw"|grep "$twdate" &gt; tmp1.txt` echo $performtw if cat tmp1.txt|grep "tw" then echo backup successfull printf "tw backup success!" | mail -s "tw backup check $date1 repor$ rm tmp1.txt else echo backup failure printf "sitename backup failure!" | mail -s "site backup check $date1 repor$ rm tmp1.txt fi exit   But this isn't working really well and I ask you if there's some simpler and more powerful way to do it? Basically it just needs to check if file exists with the name starting xyz and was created at date xyz. How I can identify which process is making UDP traffic on Linux? $(12)$ and $(123\dots n)$ are generators of $S_n$ I'm building an object detector using HOG features and linear SVM. Some of the regions of the object are more "distinctive" so I would like to give more weight to the features extracted from those regions. (e.g. imagine we want to detect between mugs and glasses, then the most "distinctive" part is the mug's handle)  How could I do this? For sure there should be a more intelligent way than just replicating the features of those "distinctive" regions. Why does my wife's skin buzz when she's using her laptop? Is there a string math evaluator in .NET? If I have a string with a valid math expression such as:  String s = "1 + 2 * 7";   Is there a built in library/function in .NET that will parse and evaluate that expression for me and return the result? In this case 15. Sum of Cosine/Exponential I try to simplify to get rid of sum $$ \sum_{k=0}^{n-1}\cos(2 \pi fk)$$  I discover I shall use euler equation to form:  $$ \sum_{k=0}^{n-1}\frac{1}{2}(e^{2 \pi fki}+e^{-2 \pi fki})$$  but how to sum exponentials? Can you attack with different weapons using Extra Attack? The fighter's  feature (PHB, p. 72) says:     Beginning at 5th level, you can attack twice, instead of once, whenever you take the Attack action on your turn.   Assuming I am holding two different weapons, and don't want to spend my bonus action on Two-Weapon Fighting, can I attack once with each weapon? 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)) Inequality about infinite cardinals The following is a question I'm interested in solving:    The idea is to solve it without using AC. As @Asaf Karagila pointed out in the comment section:  "Even if $\kappa$ is an infinite cardinal, you can't assume that $\kappa \geq \omega$ without using AC".  I am still trying to think this through: My reasoning being, that as $\kappa &gt; n \forall n \in \omega$, then $\kappa \geq \sup\{n:n\in \omega\}=\omega$ as $\omega$ is a limit ordinal.  Where does my reasoning fail? And also, a detailed solution would be very appreciated. How can I make subsections lose the section number within the section and gain the section number outside it? For a paper I am typesetting, the author wants subsections to be written with single numerals.  So far, OK,   \renewcommand{\thesubsection}{\arabic{subsection}}   does the job.  Yet frequently, he wants to cite the subsection in a later section, and wants both section and subsection numbers in references; i.e., he wants to quote Section 1.1 from Section 2.      My current workaround is to give both the section and subsection numbers in the reference.   MWE  \documentclass[11pt]{amsart} \usepackage{hyperref} \usepackage[backend=bibtex,citestyle=alphabetic]{biblatex} \renewcommand{\thesubsection}{\arabic{subsection}}  \begin{document} \section{A section} \label{sec:first} \subsection{A subsection} \label{subsect:first} Something cool. \section{New section} Now I want to cite the coolness in Section~\ref{sec:first}.\ref{subsect:first}. \end{document}     This works fine, except that the hyperref is set up so that if you click on the first 1, you go to Section 1, not Subsection 1.  Yet I would prefer that both numerals go to the same place in the hyperref links.       I could just wrap each such citation in \renewcommand{\thesubsection}'s, but is there  an easier way to add section numbers when citing subsections from a different section?   Note: Since I'm using biblatex, titlesec is not applicable. What does the tilde before a function name mean in C#? Image of Stack Exchange button is blocked by Adblock Chrome and IE 11 are fine, I'm only able to reproduce this in Firefox. Using version 27.0.1 on Windows 7. Meta as well as all the other sites are affected.        I can still see the hover effect, but the image is gone. I see this in Firebug:        The image doesn't show up in the Network tab. I am able to see the image by visiting  which goes to   I've done Ctrl-F5, I've cleared the cache and I've tried Private Browsing. Possibly related to  ? I'm referring to the colored circles with numbers next to them on the top of the page, to the right of my reputation counter. What do they represent? error: Unable to find vcvarsall.bat I'm trying to recall a story I read in the 1960s or 1970s, but which I suspect was older than that.  It was about a quasi-immortal family in the twentieth century who lived in a rural area and kept a low profile. It was a stand-alone story and only the family, and perhaps distant relatives, had unusual powers. I don't think they were aliens, just some offshoot of humanity.   They were of varying ages, ranging from relatively young to thousands of years old. They had lived in Europe before immigrating to the American colonies. Each person had a distinctive set of psi powers, ranging from the grandpa, pa, ma and son. I believe the youngest, just called Baby, was the most powerful and least human looking, and lived in the attic. He slept most of the time.  Nothing remains in my memory of the plot.  As I recall, the story had a Theodore Sturgeon feeling to it, with a humorous, ironic touch, but it probably wasn't his. I haven't been able to identify it from looking at a list of his works.  I probably read it in an anthology, but I might have seen it in an old magazine. I'm just not sure.  If anyone can help me identify it, I'd be grateful. Then I can scratch that mental itch. Drag and drop not working inside Nautilus on Ubuntu 17.10 I'm having a strange problem on Ubuntu 17.10: when I try to drag and drop something inside Nautilus it simply doesn't work, it doesn't even select the item, it seems like it's ignoring the action... Also, I cannot select things inside nautilus by drawing rectangles with the mouse.  All of these actions work only on the Desktop. Here is a demo:    I'm using the Xorg session with nVidia proprietary drivers. I also noticed that Nautilus seems to hang when I try to copy, paste or cut a file...  EDIT 1: I solved the problem for the slow copy/paste by disabling the clipboard sync plugin of KDEConnect. I also discovered that if I open Nautilus as root, I can drag and drop or select whatever I want... Passing a varible from jQuery to PHP How do I get a list of all subdomains of a domain? I want to find out all the subdomains of a given domain. I found a hint which tells me to dig the authoritative Nameserver with the following option:  dig @ns1.foo.bar some_domain.com axfr   But this never works. Has anyone a better idea/approach