I am using re.sub to remove certain part of the text. there suppose to be multiple matches, but sub function only replace one occurrence per one execution. What is going on?   import re import requests  r = requests.get('https://www.sec.gov/Archives/edgar/data/66740/000155837018000535/0001558370-18-000535.txt') text = r.content.decode() reg = re.compile('&lt;DOCUMENT&gt;\n&lt;TYPE&gt;(XML|GRAPHIC|ZIP|EXCEL|PDF)[\s\S]*?(&lt;/DOCUMENT&gt;)')  re.findall(reg, text)   `` output: [('GRAPHIC', '&lt;/DOCUMENT&gt;'),  ('GRAPHIC', '&lt;/DOCUMENT&gt;'),  ('XML', '&lt;/DOCUMENT&gt;'),  ('XML', '&lt;/DOCUMENT&gt;'),...] ``  for i in range(10):     text = re.sub(reg, '', text, re.MULTILINE)     print(len(text)) `` output: 41875141 40950114 37558399 36097349 34776527``   In the first code block, I download the txt file and did a findall. there are multiple occurrence in this file. but when I use re.sub, it only replace one occurence.  EDIT  Seems that adding flag re.MULTILINE prevent the replace. Is there a way to get around?
The Python docs say:     re.MULTILINE: When specified, the pattern character '^' matches at the beginning of the string and at the beginning of each line (immediately following each newline)... By default, '^' matches only at the beginning of the string...   So what's going on when I get the following unexpected result?  &gt;&gt;&gt; import re &gt;&gt;&gt; s = """// The quick brown fox. ... // Jumped over the lazy dog.""" &gt;&gt;&gt; re.sub('^//', '', s, re.MULTILINE) ' The quick brown fox.\n// Jumped over the lazy dog.'
If every ideal is principal show the same is true for the image of a homomorphism. How does the double strike mechanic interact with other mechanics like lifelink or trample? Replacing a toilet, when I turn the water valve off there is still water running into toilet? When trying to replace a toilet, the water valve to toilet will not stop water supply even when valve is shut off. I have opened and closed the valve several times but water continues to be supplied to toilet. Denote by $\mathbb{N}$ the set of natural numbers and by $2^{\mathbb N}$ the set of all subsets of $\mathbb N$. Let $E$ be some subset of $2^{\mathbb N}$ such that for  every pair of elements in $E$, one is a subset of the other. Clearly, $E$ could be countable by considering $E=\big\{\{1,\cdots, n\}, n\in\mathbb N\big\}$. My question is the following: could we find an example that $E$ is uncountable? Many thanks for the answer! What is "summoning sickness" and how does it affect my creatures? Note: this is intended to be a canonical question about summoning sickness.  "Summoning sickness", broadly, is the rule that stops you from attacking or paying {T} costs with a creature that you just played. But how exactly does it work? How does it interact with other rules and effects?  For example, if I'm trying to figure out how a creature is affected:   Does the status matter (tapped/untapped, face down/face up, etc.)? What if it came into play, but I didn't cast it? What if it's a token? What if it was on the battlefield when my turn started, but it wasn't a creature? What if it stops being a creature? What if it's a creature and also another card type? What if it's a double-faced card that just transformed? What if it changes control? What if it's a copy of another creature? Which of the creature's activated abilities can I use? Are any of its other abilities affected? Can I tap the creature to pay a cost that is not a {T} cost?   (These examples are primarily taken from questions about summoning sickness that have already been asked on the site) Google analytics: Tracking Not Installed Why did the Ministry of Magic choose an ax for carrying out a death sentence? Mask and inherit the same systemd unit Suppose a package provides whatever.service file so certain events (including whatever.socket) cause a daemon to start with a certain configuration.  I want to disable this completely. In particular, I want the old socket and any other unit files that might refer to this service by name to be unable to start the daemon.  Instead, I want to create my own unit files for this daemon with a different .socket unit and different environment variables. I also want my override to automatically take account of possible upstream updates to the original unit file (which my current solution of copying whatever.service as whatever-modified.service and editing it unfortunately does not provide).  If I create the following symlinks and files: /etc/systemd/system/whatever.service → /dev/null /etc/systemd/system/whatever-modified.service → /usr/lib/systemd/system/whatever.service /etc/systemd/system/whatever-modified.service.d/fix.conf  systemd considers the new service to be masked as well and refuses to start it. How to avoid this? Make account merges propagate to chat To be clear, I have access to $H(S)$ and as many $H(S||K)$ as I want. Every string $K$ is known. Can I use the extra information to my advantage and try to deduce $S$, without requiring bruteforce? Or do you still have to bruteforce but try less combinations since you have more information? Sequences in $C(X)$ converging uniformly implies uniform boundedness and equicontinuity Let $X$ be a metric space and let $\{ f_n \}_{n \geq 1}$ be a sequence in $C(X)$. Show that if $\{ f_n \}_{n \geq 1}$ converges uniformly on $X$ then $\{ f_n \}_{n \geq 1}$ is both uniformly bounded and equicontinuous.  Could I get a hint? My csv export displaying html, how to get rid of? Can the Help action be used to give advantage to a specific ally's attack (rather than just the next ally who attacks the target)? Armature keeps spinning around root bone in pose mode when I try to move anything I was following a tutorial on rigging (was pretty much done) and now my entire model keeps spinning around the main root bone if I try to move any bone at all. (first picture is where it originally was and still is while in Rest Position, second image is of how it changes when in Pose Position while in Pose Mode or Object mode, Edit Mode seems fine)    I tried clearing All Transforms or hitting the ALT+g, s, r while all were selected and that just caused it to spin in the same direction like everything else does as shown in this picture:   I was nearly finished with this video tutorial here,     and near the last part my issue began. 2:28:07 was the last time I was in edit mode and the pose was fine. Right after the little turrets he then went and parented 3 more bones and then he switches back to pose mode with no problem, I suspect somewhere in there is where the problem occurred on my end. I could have sworn I followed it correctly but maybe I went wrong somewhere I have no idea.   I couldn't find another issue like mine exactly so sorry if this question has been asked before, I'm still very new.  Edit: I checked in the video comments to see if it had happened to anyone else but I did not see any mention of it unfortunately.  Edit2: Picture for more detail on the yellow lines. When I launch certain programs from the command line like eclipse and document viewer in 11.10 it spews a load of information that seems inconsequential.   Also when they are run in the background they sometimes continue to produce output to the terminal which I am currently working on, which is irritating.  I would like them just launch and keep the background stuff in the background. My reasoning is that if you launch these programs through the GUI (eg double clicking on an icon) these messages are never shown to me, so I don't need them in the command line. Finding Zero Divisors and Units of Rings $\mathbb{Z}_n \times \mathbb{Z}_m$ BOOLEAN FUNCTIONS: generate a function $f: \{0, 1\}^n \rightarrow \{0, 1\}$ from a $n \times n$ S-Box I want to calculate the hamming weight of a S-Box using this formula: $\text{hw}(f) = \sum_{x=0}^{2^n-1} f(x)$. Where $f: \{0, 1\}^n \rightarrow \{0, 1\}$  My problem is that I don't know how to get the $f$-function.  I found that helpful paper: . At Page 9 (18) boolean functions are described. But she only prints the truth table (Table 2.1) without describing her $f$-function. She only says $f$ is a linear function, therefore I think $f$ depends on my S-Box?  For example, if I have this $2 \times 2$ S-Box:  0    1    2    3  1    3    0    2    $00 \rightarrow 01\\ 01  \rightarrow 11\\ 10  \rightarrow 00\\ 11  \rightarrow 10$  What are the $f$-functions and what is the hamming weight? ID a book about a mirror world and 4th dimension I read a book about 10-15 years ago about a boy and a girl who find a mirror. What made the mirror special was, they were able to enter the reflection and be a part of the reverse image world. They end up going to school and when asked to write something on the board, it ends up being backwards, but to them looks normal.  Later, the two end up in a world with 4 dimensions. With the added dimension they can't see as they normally could. If one moved a certain way the other would see their insides. Eventually a native of that dimension made some type of device that lets them see regularly.  Other than that my memory is blank. If I remember anything else I will be sure to edit it in. What exactly is a kilogram-meter? This question isn't just about kilogram-meters, it's about multiplied units in general.  I have a good mental conception of divided units, e.g. meters per second or grams per cubic meter.  Meters per second just (usually) means how many meters are traversed by an object each second.  Simple.  But I don't really have a mental conception of what it means when units are multiplied, e.g. a kilogram-meter.  Can anyone explain in simple physical terms what a kilogram-meter is? Syntax error while creating DB2 Trigger What is wrong in the below trigger syntax, I am getting this error An unexpected token "INT" was found following " DECLARE NULL_ROW_ID".  Expected tokens may include:  "END-OF-STATEMENT".. SQLCODE=-104, SQLSTATE=42601, DRIVER=3.68.61  CREATE TABLE A (     A_ID INT NOT NUll,     A_CODE VARCHAR(100) NOT NULL,     PRIMARY KEY(A_ID) );  CREATE TABLE B (     B_ID INT NOT NUll,     B_CODE VARCHAR(100) NOT NULL,     A_ID INT,     PRIMARY KEY (B_ID),     FOREIGN KEY (A_ID) REFERENCES A (A_ID)  );  CREATE OR REPLACE TRIGGER B_TRIGGER AFTER UPDATE OF A_ID ON B REFERENCING NEW AS N OLD AS O FOR EACH ROW     WHEN (N.A_ID IS NULL)     BEGIN ATOMIC         DECLARE NULL_ROW_ID INT;         SET NULL_ROW_ID = (SELECT A_ID FROM A WHERE A_CODE = 'Custom Null String');         IF NULL_ROW_ID IS NULL THEN             SIGNAL SQLSTATE '70000' SET MESSAGE_TEXT = 'Custom Null String row not found.';         END IF;     SET N.A_ID = NULL_ROW_ID;     END @   It's on DB2 Express-C 10.5