I have test.txt file: &quot;hi there 1, 3, 4, 5&quot;  When I use python to read it,how can I read it part by part for example first I read the first 4 character and then read the next 4 and then all of the left. my code here: with open(file, 'r', encoding='utf-8', errors='ignore') as f:              lines = f.read(4)  Use this code I can only read the first 4 character,any idea that I can ready each 4 characters in a loop until read all of them?
I have a very big file 4GB and when I try to read it my computer hangs. So I want to read it piece by piece and after processing each piece store the processed piece into another file and read next piece.  Is there any method to yield these pieces ?  I would love to have a lazy method.
Shortest sequence containing all permutations Given an integer $n$, define $s(n)$ to be the length of the shortest sequence $S = (a_1, \cdots a_{s(n)})$ such that every permutation of $\{1,\cdots,n\}$ is a subsequence of $S$.  If $n=1$, then $S = (1)$ is the shortest sequence containing all permutations of $\{1\}$, so s(1) = 1.  If $n=2$, then $S = (1, 2, 1)$ contains all permutations of $\{1,2\}$ as a subsequence, so $s(2)=3$.  Is there a general formula for $s(n)$? Find out if any files were exported from my MacBook How do AD/AP boosts apply to abilities with long cast times, channels or animations? For example: I'm playing Janna in bot lane with Caitlyn. Caitlyn begins channeling Ace in the Hole to finish off an enemy. Will the AD buff from my Eye of the Storm apply extra damage to Caitlyn's ultimate if I cast at after she begins channeling? Similarly, if I see Caitlyn rev up to shoot Piltover Peacemaker, can I boost her AD after the animation begins? (If I remember correctly, Piltover Peacemaker has a quick cast time, but the spell animation is rather long, so it may be a different circumstance from the first example.)  Basically, I want to know if the AD is calculated at the start of a cast, at the end of a cast, or when the ability actually creates and object on the battlefield. What mechanism is responsible for the creation of these dunes on Comet 67P/Churyumov-Gerasimenko?  The following high resolution picture from ESA's Rosetta mission shows the dunes:       At a distance of 7.8 km from the surface, the image scale is about   66.5 cm/pixel, so each 1024 x 1024 pixel frame is about 680 m across (although if we assume the furthest point away is an additional ~1 km   further from the centre, the image scale is about 92 cm/pixel).   So the scale of the dunes is on the order of tens of meters along the crest. And each crest are probably just a few meters apart. How to access blocked sites? I am in Pakistan and  is blocked here. I want to take the Lecture videos from YouTube. In Windows, I was using  to bypass the proxy.   But now, using Ubuntu, I don't know how to bypass the proxy. I found some where that i can bypass the proxy by using putty software. Can you guide me how can I bypass proxy by that? I tried, but I was not able to do so. Kindly tell me some easy method to bypass proxy. I don't want to used websites like accesstoblockedsites.com. Find orphaned users In SQL Server 2005, is there a way to find users that either don't exist at the server level (an account that was deleted at server level but wasn't disassociated from databases before it was deleted) or accounts that aren't linked (an account may have been deleted at the server level but not db level, then readded but the db level was never cleaned up).  I've got a very messy server and it would be awesome if there was a query to run to find these. Why do we need a waveguide in a microwave oven? Why do we need a waveguide to move microwave power from the magnetron to the microwave cavity? Can't we just push magnetron antenna into the cavity? Why does it have to go through a waveguide? How to compute $m$ value from RSA if $phi(n)$ is not relative prime with the $e$? Here is some information we got : We know the value of $n$, with size $1043$. We know the value of $p$ (size $20$) and $q$ (size $1023$) as the factors. $e = 65537.$ $\varphi(n)$ = $(q-1)(p-1)$ When I calculated $\gcd$ and $\text{modinv}$, I got : $\gcd(e,\varphi(n)) = 65537$ $modinv(e,\varphi(n)) = 1 $ So we can tell that they are not relatively prime. So, how to compute the d, and get the value of m? I'm not that good with math, so I cant understanding well the theory. so can anyone please make an example implementation or write a clear formula? Why is ANOVA taught / used as if it is a different research methodology compared to linear regression? ANOVA is equivalent to linear regression with the use of suitable dummy variables. The conclusions remain the same irrespective of whether you use ANOVA or linear regression.   In light of their equivalence, is there any reason why ANOVA is used instead of linear regression?   Note: I am particularly interested in hearing about technical reasons for the use of ANOVA instead of linear regression.   Edit  Here is one example using one-way ANOVA. Suppose, you want to know if the average height of male and females is the same. To test for your hypothesis you would collect data from a random   sample of male and females (say 30 each) and perform the ANOVA analysis (i.e., sum of squares for gender and error) to decide whether an effect exists.  You could also use linear regression to test for this as follows:  Define:  $\text{Gender} = 1$ if respondent is a male and $0$ otherwise. $$ \text{Height} = \text{Intercept} + \beta * \text{Gender} + \text{error} $$ where: $\text{error}\sim\mathcal N(0,\sigma^2)$  Then a test of whether $\beta = 0$ is a an equivalent test for your hypothesis. How is canonicity of derivative works determined for Star Wars? For all types of derivative works, namely:   Movies Novels Comic books Other written works (including RPG materials) Cartoons Video games Derivative movies (such as the infamous Ewok movies and even more infamous )   According to what rules does something become "canon" and who is responsible for the evaluation of a published work? Does Thanos's choice make any sense? So we know from Infinity War that Thanos was collecting all the Infinity Stones to basically solve the problems brought about by overpopulation on many planets.  But does it make any sense? He could've just easily increased the resources or changed the area or taken appropriate measure to handle that situation. As far as I know, collecting all the Infinity Stones gives the user limitless power and control over the universe in the MCU.  Is Thanos just a mass murderer or is there something I'm missing? Related to the question :  It is well known that   $$\zeta(2n) = f(2n) \pi^{2n}$$  where $f(n)$ is an function in rationals: (the denominator = OEIS : 6, 90, 945, 9450).  Apery proved that $\zeta(3)$ is irrational, and presumably $f(2n+1)$ is so for all (but the latter is open).  But what else is known about $f(2n+1)$? What sort of pattern does it share (if any) with $f(2n)$? Numerically does it fit well? Is there any clue/progress since Apery as to its form? Of course, $f(2n+1)$ may in effect divide out the $\pi$, meaning that somehow $\pi$ is not involved in $\zeta(2n+1)$ in any essential way. Word for killing off or attempting to kill off an entire bloodline? I would like to know if there is a word or phrase for a systematic campaign to annihilate every descendant of a particular ancestor.   We have the word 'genocide' for killing off an entire race, and plenty of words for killing people based on how they are related to you (fratricide, filicide, et. al.), but looking over the  and the , I couldn't find a term for systematically killing an entire bloodline.   My question is prompted by a US news story about the horrific murder of 8 members of the same family, but those murders are not an example of what I'm thinking of because the children of the victims were left alive, so the motive for the killings was not to kill off the bloodline. The sense that some group had coordinated an attack against just one family is what made me wonder what the "not an entire race, just one bloodline" version of 'genocide' would be called.   Searching the Internet for "kill off" and bloodline sends me straight into the land of vampires, Illuminati, reptilian overlords, and, naturally, Priory of Sion nonsense so I haven't had much luck finding a thread to pull.   It may be that there is no word for it in the sense of murdering a human bloodline, because we just don't attempt kill off our royals down to the last heir often enough to coin a term for it. Maybe there is a scientific term for culling a line from a test population as part of biological research? SQL JOIN - WHERE clause vs. ON clause After reading it, this is not a duplicate of . The answer may be related (or even the same) but the question is different.    What is the difference and what should go in each?  If I understand the theory correctly, the query optimizer should be able to use both interchangeably. Mean Value theorem problem?(inequality) I'm trying to solve this mean value theorem problem but confused where to start,     If $0&lt;a&lt;b$ prove that $(1-\frac{a}{b})&lt;\ln\frac{b}{a}&lt;\frac{b}{a}-1$   Can someone please lend me a hand? Ignore .DS_Store and Icon files in a folder with Cocoa NSFIleManager What do I need to consider to choose between dSLR, mirrorless, or a compact as my first "serious" camera? I am thinking of buying a camera to learn photography. Most of the time I'll be shooting portraits and landscapes. But I am not sure where I should start. Most of my friends tell me that I should get an entry level DSLR, but I am not sure if I have the persistence and enthusiasm to carry it all day in a backpack. But the camera on my cellphone doesn't seem to be enough to begin with.  So what I want is some expert advice (preferably with professional experience). Can most compact fixed-lens or mirrorless cameras fit the situations I mentioned? Or do I really need to go to a DSLR to get a tool to learn photography? Read two column CSV as dict with 1st column as key I have this struct:  struct Map {     public int Size;      public Map ( int size )     {         this.Size = size;     }      public override string ToString ( )     {         return String.Format ( "Size: {0}", this.Size );     } }   When using array, it works:  Map [ ] arr = new Map [ 4 ] {     new Map(10),     new Map(20),     new Map(30),     new Map(40)};  arr [ 2 ].Size = 0;   But when using List, it doesn't compile:  List&lt;Map&gt; list = new List&lt;Map&gt; ( ) {     new Map(10),     new Map(20),     new Map(30),     new Map(40)};  list [ 2 ].Size = 0;   Why? Distribution of $-\log X$ if $X$ is uniform. For $X$ and $Y$ random variables; $X$ follows the uniform distribution.  (1): if $Y=-\log X$  (2): then it can be shown that $-\log X$ is distributed as $\exp(1)$ {i.e. exponential with mean 1}.  Why is this so? Intuitively statement (2) make sense to me. But i'd like a mathematical proof.  -Probably wrong working:  (1) seems to imply $\exp(-Y) = X$ (which is like saying $X$ is exponentially distributed, which is a contradiction, since its actually uniform!); or is it incorrect for me to do this since $X$ and $Y$ are random variables?  Ultimately how do I prove (2)?  Thanks