Store Text File Number as Python Variable
What special characters must be escaped in regular expressions?
$$\sum_{n = 1}^\infty \frac{(-1)^n}{p_n}$$ where $p_n$ is the $n$th prime.  I have computed this to 10000 rather than infinity. My results suggest that convergence does happen but it's very slow. But I can't even be sure about the first few digits: $-0.26959$?  I have looked at the "questions that may already have your answer" and some of the "similar questions," but they involve somewhat different formulas. Can you make multiple "if" conditions in Python? How to know that your machine learning problem is hopeless? Imagine a standard machine-learning scenario:     You are confronted with a large multivariate dataset and you have a   pretty blurry understanding of it. What you need to do is to make   predictions about some variable based on what you have. As usual, you   clean the data, look at descriptive statistics, run some models,   cross-validate them etc., but after several attempts, going back and   forth and trying multiple models nothing seems to work and your   results are miserable. You can spend hours, days, or weeks on such a   problem...   The question is: when to stop? How do you know that your data actually is hopeless and all the fancy models wouldn't do you any more good than predicting the average outcome for all cases or some other trivial solution?  Of course, this is a forecastability issue, but as far as I know, it is hard to assess forecastability for multivariate data before trying something on it. Or am I wrong?   Disclaimer: this question was inspired by this one  that did not attract much attention. It would be nice to have detailed answer to such question for reference. Key to get help about current function Do you mind me / my Do the following sentences mean the same?        Do you mind if I open the window?   Do you mind me opening the window?   Do you mind my opening the window?      for me they all mean the same, bit #3 is a little less common as far as I've seen so far. Do you agree with me?  PS. I am more about the AmE register. Transparent background but solid title bar and text in Windows 7 I'd like to have a terminal like the one in Ubuntu where the background is transparent but title bar and text is still solid. I have tried Console, but setting the alpha value makes the entire window transparent, which makes the text hard to see.  Is that possible? Implementing a sort of "tightened frenchspacing" By default, (La)TeX adds extra space between sentences. The exact rules are in the TeXbook, a summary by TH. can be found . What follows is is my "executive summary":   After any period (or quotation/exclamation mark) that doesn't follow a capital letter, TeX adds a font's "extra space" to the "normal (interword) space". For Computer Modern 10pt, the normal space is 3.33pt and the extra space 1.11pt, resulting in an intersentence space of 4.44pt (+33% compared to the nomal space, assuming no stretch and shrink). A sentence end after a capital letter is indicated by the \@ command: Ann is learning the ABC\@. To denote that a period after a lowercase letter doesn't end a sentence, one may use \@ as well as an explicit space: Prof.\@ Higgins or Prof.\ Higgins.   Intersentence spacing may be brought in line with normal spacing by issuing the \frenchspacing command. (This is the standard setting for certain languages, e.g. the  (n)german option of the babel package.) With \frenchspacing enabled, there's no need to use the \@ command. One may revert to (La)TeX's default behavour by issuing \nonfrenchspacing.  So, there's the choice between extra intersentence spacing and uniform spacing. What is missing in my opinion is a third option I'll call "tightened frenchspacing": normal (interword) spacing between sentences and decreased spacing after non-sentence ending periods. To be somewhat more precise (while still ignoring stretch and shrink), I envision the following:   Adhering to a font's ratio between "normal space" and "normal space plus extra space" (3:4 for Computer Modern), the intersentence space is set to the normal space. The space after non-sentence ending periods equals the normal space multiplied by the above ratio (resulting in a space of 2.5pt for Computer Modern). As with \nonfrenchspacing in effect, the \@ command is used to denote cases of special punctuation.   How should such a "tightened frenchspacing" option be implemented?  EDIT: Thanks to Mico for providing what may well be a stepping stone to a solution. Here's another attempt at clarification:   Simply reducing the spacing after any period is not what I had in mind. There should be a (tangible) difference between end-of sentence spaces and spaces after non-sentence-ending periods (only that the latter should be reduced instead the former augmented). If adhering to a font's normal space/extra space ratio is not possible, a solution that adds a fixed (reduced) space (say, a thin space) after non-sentence-ending periods will be accepted. For compatibility reasons, I'd prefer a solution that works with the traditional use of \@ (i.e allows "tightened frenchspacing" for existing documents without the need to change the document body). Should it turn out that a different set of "special punctuation" macros is needed, I'll accept this as a solution. Attacks of the MAC construction $\mathcal{H}(m\mathbin\|k)$ for common hashes $\mathcal{H}$? Need help with SQL Server PIVOT I know about the PIVOT feature in SQL Server and I've read a few other questions and answers on here but I just can't seem to grasp it in order to do what I need. I'm trying to run some calculations and I have the following:  TABLE office_settings column office_id (bigint not null) column setting_value (NVARCHAR(500) NOT NULL)  office_id    setting_value -------------------------------------------- 4             0.2 4             0.2 4             2 4             3 5             0.2 5             0.2 5             2 5             3   I'd like to convert this using PIVOT (assuming that's the right tool for the job) to this, basically "grouping by" the office_id column, so:  office_id    value_1    value_2    value_3   value_4 ------------------------------------------------------     4         0.2         0.2         2         3     5         0.2         0.2         2         3   I should also mention that I need to CAST the setting_value column values to DECIMAL(4,2) in the process of this - in case that has any bearing on the T-SQL required to accomplish it.  Any ideas? Write down the sum of sum of  sum of digits of $4444^{4444}$ Let $A = 4444^{4444}$;  Then sum of digits of $A = B$; Then sum of digits of $B = C$; Then sum of digits of $C = D$;  Find $D$.  What should be the approach here? How to reinstall default packages In an attempt to uninstall wine I ran the command sudo apt-get purge wine* which as you may have guessed removed many of the default packages. I am wondering if there is a way to use the installation disk to reinstall the default packages without overwriting the file system. Not sure if it makes a difference or not, but I am duel booting Windows 8 and Ubuntu 14.04 which was updated from Ubuntu 12.04.  Thanks in advance. Am I going to have trouble flying without my full name on the ticket? In my passport, my name is Firstname middlename1 middlename2 lastname, and in the ticket is LASTNAME/FIRSTNAME MR.  Will be a problem? I'll travel from Brazil to Bali, Indonesia and according to the agency I bought the ticket from, there's no problem and it's common.  The airline is Qatar Airlines and I have looked , which says that the passenger name can't be changed after the booking has finished.  But I don't know if it is a problem. I am pretty sure $(B_{t}^{2})$ not Markov because the squared random walk is not.    I guess I can repeat the method since to be Markov it must satisfy the discrete.  Thanks Bag A has $3$ white and $2$ black marbles. Bag B has $4$ white and $3$ black marbles.  Suppose we draw a marble at random from Bag A and put it in Bag B. After doing this, we draw a marble at random from Bag B, which turns out to be white. Given this information, what is the probability that the marble we moved from Bag A to Bag B is white?  At first since the probability that white is $1/2$ is $2/5$, and the probability that white is $5/8$ is $3/5$, I thought a sufficient answer would be $$\begin{align}\tfrac 1 2 \cdot \tfrac 2 5 + \tfrac 5 8 \cdot \tfrac 3 5 &amp; = \tfrac 1 5 + \tfrac 3 8 \\ &amp; = \tfrac 8 {40} + \tfrac {15}{40} \\ &amp; = \tfrac {23}{40}\end{align}$$, but that was wrong.   Can someone provide me with an answer? Thanks $\sqrt{1-x^2}$ is not a rational function If $k$ is a field in which $1 + 1 \neq 0$, prove that $\sqrt{1-x^2}$ is not a rational function. Hint. Mimic the classical proof that $\sqrt{2}$ is irrational   It seems rather odd to discuss the square root function in the context of an arbitrary field, but here goes nothing!  Proof:   Suppose that $\sqrt{1-x^2}$ is a rational function in $k(x)$. Then there exist polynomials $p(x)$ and $q(x) \neq 0$ that are relatively prime with $\sqrt{1-x^2} = \frac{p(x)}{q(x)}$; clearly we may take $p(x) \neq 0$. Then $1-x^2 = \frac{p(x)^2}{q(x)^2}$ or $q(x)^2(1-x^2) = p(x)^2$, which says $q^2 | p^2$, and since $q | q^2$, we can infer $q | p^2$. Moreover, since $p|p^2$ and $(p,q)=1$, then $pq|p^2$ or $q|p$, which contradicts the fact that the polynomials are relatively prime. Hence $\sqrt{1-x^2}$ cannot be a rational function.    How does this sound? Aside from the problem of discussing $\sqrt{~~}$ in the context of an arbitrary field, I am worried about not using the fact that $1+1 \neq 0$, at least not explicitly. Where exactly is this assumed used, if at all?  EDIT:  Suppose that $q(x) =1$, and let $f(x) = a_n x^n + ... a_1 x + a_0$. Then $1-x^2 = f(x)^2$. If $x=0$, $1 = a^2_0$ and therefore $a_0$ must be a unit. Letting $x=1$ we get $0 = (a_n + ... + a_1 + a_0)^2$; and letting $x=-1$ we get $0 = (-a_n - ... - a_1  + a_0)^2$. Since we are working in a field, there can be no nonzero nilpotent which means that $a_n + ... + a_1 + a_0$ and $-a_n - ... - a_1  + a_0$ are both zero. Adding the two equations together yields $2a_0 = 0$, and since $1+1 \neq 0$, $a_0 = 0$ which contradicts the fact that $a_0$ is a unit.   How does this sound?  Another attemtpt:  If $f(x)^2 = 1-x^2$, then $2 = \deg(f^2) = 2 \deg (f)$ implies $\deg(f) = 1$. Yet if $x=-1$, we get $f(-1)^2 = 1 - 1 = 0$ and therefore $f(-1)=0$ since there are no nonzero nilpotent elements in a field; similarly, $f(1)=0$. Since $1+1 \neq 0$, $f$ has two distinct roots in $k$ yet is only a $1$-st degree polynomial, a contradiction. I'm currently studying  and Python programming. I just want to know how I would go about executing a Linux command in Python. The commands I want to execute are:  echo 1 &gt; /proc/sys/net/ipv4/ip_forward iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080   If I just use print in Python and run it in the terminal will it do the same as executing it as if you was typing it yourself and pressing Enter? Is is possible that a software issue could be causing spotty USB-C connections on 2017 MacBook Pro? I have a 2017 MacBook Pro. It has 2 USB-C ports on the left side and I use an Aukey hub to provide more ports (4 USB, 1 HDMI, 1 USB-C) and always to connect two monitors.   I connect one monitor through the hub with the HDMI port and another directly to the MBP with a USB-C adapter. Sometimes when I connect the hub to the Mac and the 2nd monitor to the Mac, it works as it should with no problem...but more than half the time I have to connect, disconnect, jiggle, jangle, switch ports, reconnect HDMI, etc. and hopefully they will both work. OFTEN, I can only get one monitor to fire up.  Is there any kind of software fix or reset that might solve this issue? Any other thoughts welcome. Thanks. I have a list of integers, List&lt;Integer&gt; and I'd like to convert all the integer objects into Strings, thus finishing up with a new List&lt;String&gt;.  Naturally, I could create a new List&lt;String&gt; and loop through the list calling String.valueOf() for each integer, but I was wondering if there was a better (read: more automatic) way of doing it? Logins with only HTTP - are they as insecure as I'm thinking? Recently I was thinking about how websites like gmail and amazon use HTTPS during the login process when accessing your account. This makes sense, obviously, since you're typing in your account username and password and you would want that to be secure. However, on Facebook, among countless other websites, their logins are done with simple HTTP. Doesn't that mean that my login name and password are completely unencrypted? Which, even worse, means that all those people who login to their facebooks (or similar sites) at a wifi hotspot in public are susceptible to anyone getting their credentials using a simple packet sniffer (or something similar)? Is it really that easy? Or am I misunderstanding internet security?  I'm a software engineer working on some web related stuff, and although at the current time I'm not too involved with the security aspect of our software, I knew I should probably know the answer to this question, since it's extremely fundamental to website security.  Thanks! How can one prove the Bohr-Sommerfeld quantization condition $$ \oint p~dq ~=~2\pi n \hbar $$ from the WKB ansatz solution $$\Psi(x)~=~e^{iS(x)/ \hbar}$$ for the Schroedinger equation? With $S$ the action of the particle defined by Hamilton-Jacobi equation $$ \frac{\partial S}{\partial t}+ \frac{(\nabla S)^{2} }{2m}+V(x)~=~0 .$$