I am trying to rescales x to lie between lower and upper  rescale &lt;- function(x, lower = 0, upper = 1){ slope &lt;- ?? intercept &lt;- ?? y &lt;- intercept + slope * x return(list(new = y, coef = c(intercept = intercept, slope = slope))) }   And this is the hint from my professor: The linear transformation should map the minimum of x to lower and the maximum of x to upper. (Hint: what is the equation for a line passing through two points?) Note in calculating the minimum and maximum that x may contain NA values; make sure your function can handle this. And the return would look like:      **&gt; rescale(c(1:10, NA), -1, 1)     $new     [1] -1.0000000 -0.7777778 -0.5555556 -0.3333333 -0.1111111 0.1111111     [7] 0.3333333 0.5555556 0.7777778 1.0000000 NA      $coef     [1] -1.2222222 0.2222222**   So does anyone has ideas on what the "slope" and "intercept" here should be?
I am lost in normalizing, could anyone guide me please.  I have a minimum and maximum values, say -23.89 and 7.54990767, respectively.  If I get a value of 5.6878 how can I scale this value on a scale of 0 to 1.
Change location of macOS Notification Center alerts? Is it possible to change where macOS Notification Center alerts appear on the screen?  They currently appear at the top right of the screen with the menu bar:    Alerts appearing in the top right tend to cover up work I'm doing more often than not. They cover up browser tabs, toolbar icons, and window titles.  I would prefer, say, the bottom right corner of the screen.  If moving the alerts is not possible, is it possible to change the screen on which they appear? $A \cup B$ and $A \cap B$ connected $\implies A$ and $B$ are connected Let $X$ be a topological space. Let $A$ and $B$ be two subsets of $X$ such that: $A$ and $B$ are closed, $A \cup B$ is connected, $A \cap B$ is connected     Prove that $A$ and $B$ are connected.   Thoughts:  Suppose that $A$ is disconnected. Since $A$ is closed, there are two non-empty, disjoint, closed sets $E$ and $F$ in $X$ such that $A = E \cup F$. Then I attempted many things but all were not really useful.  Please help. Thanks. sed fails to remove newline character To prove that $f_n(x) = \frac{nx}{1+n^2x^2}$ does not uniformly converge to $f(x) = 0$ on $[0,1]$ My Approach. To prove the given statement it is sufficient to show that $$\exists \epsilon &gt; 0, \exists x \in [0,1], \forall N \in \mathbb{N}, \exists n &gt; N $$ $$ \Rightarrow | f_n(x) - f(x)| &gt; \epsilon$$    Let $\epsilon = \frac{1}{10}, x = \frac{1}{n}, n =N+1$. Hence $| f_n(x) - f(x)| = \frac{1}{2} &gt; \epsilon = \frac{1}{10}$. Hence, we have shown for every $N \in \mathbb{N}$, how to choose $n$ such that $| f_n(x) - f(x)| &gt; \epsilon$. Thus, $f_n(x)$ does not converge uniformly on $[0,1]$.    Is there any logical flaw or wrong steps in my proof. Any help would be appreciated. Cannot use polyglossia/babel with biblatex in LuaTeX: etoolbox Toggle undefined This is an example test.tex document. Both babel and polyglossia failed and produce the same error: \documentclass{book}  %\usepackage[vietnamese]{babel} \usepackage{polyglossia} \setdefaultlanguage{vietnamese}  \usepackage{biblatex}   \title{Sth}  \begin{document}  \maketitle  \end{document}   is the full log. And my config for VS Code: &quot;latex-workshop.latex.recipes&quot;: [     {         &quot;name&quot;: &quot;lualatex-&gt;biber&quot;,         &quot;tools&quot;: [             &quot;lualatex&quot;,             // &quot;biber&quot;,         ]     } ], &quot;latex-workshop.latex.tools&quot;: [     {         &quot;name&quot;: &quot;lualatex&quot;,         &quot;command&quot;: &quot;lualatex&quot;,         &quot;args&quot;: [             &quot;--shell-escape&quot;,             &quot;-synctex=1&quot;,             &quot;-interaction=nonstopmode&quot;,             &quot;-file-line-error&quot;,             &quot;-pdf&quot;,             &quot;%DOC%&quot;         ]     },     {         &quot;name&quot;: &quot;biber&quot;,         &quot;command&quot;: &quot;biber&quot;,         &quot;args&quot;: [             &quot;%DOCFILE%&quot;         ]     } ],  I installed all Vietnamese-related package I found using tlmgr search, notably babel-vietnamese and vntex, to no avail. When I use English language, it works. When I paste the exact document to Overleaf, it also works. So it's something on my part. How can I fix this? Is $\sum\limits_{n=1}^{\infty}\frac{n!}{n^n}$ convergent? How do I tell if a regular file does not exist in Bash? maximize volume of triangle in given perimeter How do I safely investigate a USB stick found in the parking lot at work? I work at an embedded software company. This morning I found a USB stick in the parking lot in front of the building. With all the stories of "dropped USB stick attacks" in mind, I'm obviously not going to just plug it into my laptop. OTOH, I'm curious to know whether this was actually an attempt to compromise our systems, or it's really just an innocent case of somebody accidentally losing a USB stick. How do I safely inspect the USB stick without risking exposure?  I'm worried not just about malware and crafted file system images; there's also stuff like power surge attacks:.  EDIT: Many of the answers seem to assume I want to keep the drive and use it afterwards. I have no interest in that at all, I know USB sticks are cheap, and that it wouldn't be mine to keep anyway. I only want to know whether this was indeed a semi-targeted attack, partly out of curiosity whether this actually happens in real life and not just in security papers, but also so that I could warn my coworkers.  I want to know how I would figure out whether the stick contains malware. And that's not just a matter of looking at the drive contents and seeing a suspicious autorun.inf or a carefully crafted corrupt file system - I very much also want a way to inspect the firmware. I sort-of expected that there were tools for extracting that and comparing to known-good or known-bad binaries. Don't show pending suggested edits to me after I run out of votes Clone Ubuntu system to a pendrive and make it bootable? I have Ubuntu 14.04 installed on my laptop. Can I clone the entire system with apps, settings, etc on a USB 3 pendrive, and then boot from that on other computers as a portable Ubuntu installation to take around with me?  I am trying a function that Timeshift has that's called "Clone the current system on another device". I've selected the pendrive as the target device. Timeshift was talking about this being bootable. But is it going to bootable on only this laptop, or on any system? For example, on an Intel Mac, or a Windows computer without the grub bootloader? Is that Timeshift function what I am looking for, or do I have to do something else?  Edit: The Timeshift clone failed to boot on the first system I tested it on. (A Dell Hackintosh that usually boots from USB just fine.) I am fascinated by the way the CLR and GC works (I'm working on expanding my knowledge on this by reading CLR via C#, Jon Skeet's books/posts, and more).  Anyway, what is the difference between saying:  MyClass myclass = new MyClass(); myclass = null;   Or, by making MyClass implement IDisposable and a destructor and calling Dispose()?  Also, if I have a code block with a using statement (eg below), if I step through the code and exit the using block, is the object disposed of then or when a garbage collection occurs? What would happen if I call Dispose() in the using block anyay?  using (MyDisposableObj mydispobj = new MyDisposableObj()) {  }   Stream classes (eg BinaryWriter) have a Finalize method? Why would I want to use that? Question: Are there infinitely many primes of the form $4n+3$ and $4n+1$?  My attempt: Suppose the contrary that there exist finitely many primes of the form $4n+3$, say $k+1$ of them: $3,p_1,p_2,....,p_k$  Consider $N = 4p_1p_2p_3...p_k+3$, $N$ cannot be a prime of this form. So suppose that $N$=$q_1...q_r$, where $q_i∈P$  Claim: At least one of the $q_i$'s is of the form $4n+3$:  Proof for my claim: $N$ is odd $\Rightarrow q_1,...,q_r$ are odd $\Rightarrow q_i \equiv 1\ (\text{mod }4)$ or $q_i ≡ 3\ (\text{mod }4)$  If all $q_1,...q_r$ are of the form $4n+1$, then $(4n+1)(4m+1)=16nm+4n+4m+1 = 4(\cdots) +1$  Therefore, $N=q_1...q_r = 4m+1$. But $N=4p_1..p_k+3$, i.e. $N≡3\ (\text{mod }4)$, $N$ is congruent to $1\ \text{mod }4$ which is a contradiction.  Therefore, at least one of $q_i \equiv 3\ (\text{mod }4)$. Suppose $q_j\equiv 3\ (\text{mod }4)$  $\Rightarrow$ $q_j=p_i$ for some $1\leq i \leq k$ or $q_j =3$  If $q_j=p_i≠3$ then $q_j$ | $N = 4p_1...p_k + 3 \Rightarrow q_j=3$ Contradiction!  If $q_j=3$ ($\neq p_i$, $1\leq i \leq k$) then $q_j | N = 4 p_1...p_k + 3 \Rightarrow q_j=p_t$ for some $1 \leq i \leq k$ Contradiction!  In fact, there must be also infinitely many primes of the form $4n+1$ (according to my search), but the above method does not work for its proof. I could not understand why it does not work. Could you please show me?  Regards Suppose $\displaystyle P(x,y)$ a polynomial in the variables $x,y$.   For example, $\displaystyle x^4$ or $\displaystyle x^3y^2 + 3xy + 1$.  Is there a general method which allows us to evaluate the indefinite integral     $$ \int P(\sin x, \cos x) \text{d} x$$   What about the case when $\displaystyle P(x,y)$ is a rational function (i.e. a ratio of two polynomials)?   Example of a rational function: $\displaystyle \frac{x^2y + y^3}{x+y}$.    This is being asked in an effort to cut down on duplicates, see here:   and here: Integrating $\int_0^1 \frac {\log(1-x)\log^2(1+x)}x \mathrm{d}x$ Question: Integrate$$\int\limits_0^1dx\,\frac {\log(1-x)\log^2(1+x)}x=-\frac {\pi^4}{240}$$   I'm curious as to if there is a way to integrate this. I've tried using integration by parts to get$$I=-\frac {\pi^2}6\log^22+2\int\limits_0^1dx\,\frac {\operatorname{Li}_2(x)\log(1+x)}{1+x}$$However, I'm not sure how to continue even further. The polylog in the second integrand seems a bit intimidating and I don't see how the first term even helps. What's the best way to check if a file exists in C? How to read such figures with % as "up (by) 120%" and "increased (by) 120%". Do they mean the same? Ubuntu MATE freeze on logout/shutdown/reboot when running on Intel graphics card Over the years I've written some libraries. These libraries sometimes depend on each other.  As a result, the "tex" directory is structured as follows:  tex ├── library |   ├── library1.sty |   ├── library2.sty |   └── library3.sty ├── project1 |   ├── master.tex |   ├── chapter1.tex |   └── chapter2.tex ├── project2 |   └── article.tex └── project3     └── paper.tex   The libraries depend on each other. As a result, in every library that depends on another library, this is part of the header:  %library2.sty \ProvidesPackage{library2} \RequirePackage{../library/library1}   In other words, the library is imported from the "root of every project". This is not a good design choice. What if someone copies the libraries in the folder of the root of a project, or what if the folder "library" is renamed...  It is however reasonable the "active directory" still remains in the project root.  What can be done to resolve such library dependencies? What are Extension Methods? What are extension methods in .NET?    EDIT: I have posted a follow up question at