I have this piece of HTML:  &lt;span style="color: rgb(85, 85, 85); font-family: Arial,Verdana,Helvetica; font-size: 10pt; font-weight: normal; line-height: 14pt;"&gt;LG ha tolto i veli al nuovo&amp;nbsp;LG Chocolate, nome in codice &lt;strong&gt;BL40&lt;/strong&gt;, un cellulare dalla forma insolita e dai contenuti tecnologici molto avanzati.&amp;nbsp;A prima vista colpisce subito l'imponente &lt;strong&gt;schermo LCD da&amp;nbsp;4 pollici&amp;nbsp;e risoluzione di 800x345 pixel&lt;/strong&gt;, che corrispondono a un f&lt;strong&gt;ormato di&amp;nbsp;21:9&lt;/strong&gt;. Questo rapporto d'aspetto permette di vedere a tutto schermo i film in questo formato, ma non solo: a beneficiarne è infatti anche la navigazione sui siti Internet. Grazie poi alla funzionalità&amp;nbsp;Dual Screen UI&amp;nbsp;è possibile visualizzare contemporaneamente sullo schermo due tipi di contenuti differenti.&lt;/span&gt;   I'm using regular expression to strip the span. I must strip the span with the exact match, because I'm processing about 12.000 document.  I'm using:  $string = preg_replace( '/&lt;span style="color: rgb(85, 85, 85); font-family: Arial,Verdana,Helvetica; font-size: 10pt; font-weight: normal; line-height: 14pt;"&gt;(.*?)&lt;\/span&gt;/s', '&lt;p&gt;$1&lt;/p&gt;',$string);   It doesn't work, I try also with Rubular. Why?
I'm looking for a single line regex which does the following:  Given a HTML tag with the "name" attribute, I want to replace it with my own attribute. If that tag lacks the name attribute, I want to implant my own attribute. The result should look like this:  &lt;IMG name="img1" ...&gt; =&gt; &lt;IMG name="myImg1" ...&gt; &lt;IMG ...&gt; =&gt; &lt;IMG name="myImg1" ...&gt;   Can this be done with a single line regex?
Help identifying an error type "tried to help me learning" I have a friend from Russia who is trying to learn English and recently used the sentence "He tried to help me learning..." (implied: the English language)  It is obviously wrong and I corrected it telling her that she was supposed to say: "He tried to help me learn.", but I have a hard time explaining to her why it is incorrect since I'm not an expert on grammar either.  Is it a case of confusing the present simple and present continuous or does it have something to do with gerunds and infinitives? Any help would be highly appreciated! Enum ToString with user friendly strings My enum consists of the following values:  private enum PublishStatusses{     NotCompleted,     Completed,     Error };   I want to be able to output these values in a user friendly way though. I don't need to be able to go from string to value again. Conjugacy classes in $A_n$. Suppose $n$ is a non negative integer $\geq 4$ and $\sigma\in S_n$ a permutation. Conjugacy classes in $S_n$ are completley determined by the cycle structure of $\sigma$. If we let the alternating group $A_n$.act on $S_n$ by conjugation, the orbits coincide with the conjugacy classes in $S_n$ except for those (even) permutations whose cycle structure is composed of even cycles (which corresponds to cycles of uneven length) of distinct order (fixed points are treated as cycles of length $1$.) See   For instance a $3$-cycle in $A_4$ has cycle structure $[3,1]$ which fits the bill, and a $5$-cycle in $A_5$ or $A_6$ works too, since the cycle structure is $[5]$ and $[5,1]$ respectively. On the other hand, a $3$-cycle in $A_5$ will does not satisfy the criteria as it has cycle structure $[3,1,1]$ with two fixed points.  In this case, the conjugacy class of $\sigma$ inside $S_n$ splits in $2$ orbits of the conjugation action of $A_n$, and if $\tau$ is any odd permutation, for instance $(12)$, then we have $$\mathrm{Conj}_{S_n}(\sigma)=\mathcal{O}(\sigma)\coprod\mathcal{O}(\tau\sigma\tau^{-1})$$  My question is How can we differentiate between the two orbits? Does it have geometric meaning?    I can see that this information can be useful when looking at representations of the alternating groups, since there are as many irreducible representations as conjugacy classes. As for some geometric interpretation, I ask because there is one for the three cycles in $A_4$. If $S_4$ is understood as the group of symmetries of a regular tetrahedron, then $A_4$ is the subgroup of direct symmetries, and a $3$-cycle corresponds to a rotation of angle $\frac{2\pi}{3}$ or $\frac{4\pi}{3}$ with axis passing through one of the vertices. Conjugacy classes inside $A_n$ preserve the angle, and that's how we can tell them apart. In this case the computations are so simple we don't really need this picture, but I think it is a nice way to understand the fact $3$-cycles in are not all conjugate inside $A_4$... Ubuntu 14.04 slow wireless connection How can I restrict various roles with limit in creating nodes of a particular content type How can I restrict various roles with limit in creating nodes of a particular content type? What is the best way to remove duplicate rows from a fairly large SQL Server table (i.e. 300,000+ rows)?  The rows, of course, will not be perfect duplicates because of the existence of the RowID identity field.  MyTable  RowID int not null identity(1,1) primary key, Col1 varchar(20) not null, Col2 varchar(2048) not null, Col3 tinyint not null Can the Detect Magic spell detect prepared spells or spellcasters? Inspired by a recent question about discerning divine and arcane spellcasters, of like to hear the case for and against detecting spellcasters of either style with .  I think you can detect whether someone has prepared spells, based on this language:     For the duration, you sense the presence of magic within 30 feet of you. If you sense magic in this way, you can use your action to see a faint aura around any visible creature or object in the area that bears magic, and you learn its school of magic, if any. (emphasis mine)   Preparing spells is described as having the spell "fixed in mind" (). I'd argue that qualifies as bearing magic, and opens the door to using detect magic to identify spellcasters with currently prepared spells. What do you think? Expected number of rolling a pair of dice to generate all possible sums A pair of dice is rolled repeatedly until each outcome (2 through 12) has occurred at least once. What is the expected number of rolls necessary for this to occur?  Notes: This is not very deep conceptually, but because of the unequal probabilities for the outcomes, it seems that the calculations involved are terribly messy.  It must have been done already (dice have been studied for centuries!) but I can't find a discussion in any book, or on line. Can anybody give a reference? Define ≡ in this situation? How prove $\frac{a^2}{a+2b^2}+\frac{b^2}{b+2c^2}+\frac{c^2}{c+2a^2}\ge 1$ let $a,b,c$ be postive real numbers ,and such $$ab+bc+ac=3$$   show that   $$\dfrac{a^2}{a+2b^2}+\dfrac{b^2}{b+2c^2}+\dfrac{c^2}{c+2a^2}\ge 1$$   This problem is from Secrets In Inequalities volume 1  page 30,example 1.24. the comment.the  author this case is a bit more diffcult,But this author can't post solution.Thank you I get this error: dpkg: unrecoverable fatal error, aborting: files list file for package `fonts-tlwg-kinnari' contains empty filename Why does the light side of the moon appear not to line up correctly with the evening sun? Sentient Bomb in a city on the moon? I would like to know the title of the short story that I believe takes place on the moon.  The setting is a mall or some other very public location and the main character is a police officer.  She needs to talk a sentient bomb out of exploding.  I know there was the John Carpenter film "Dark Star" with a similar plot line but I'm trying to identify the short story and the author. Locking a vehicle bicycle rack We are planning a trip with a bike rack attached to our trailer hitch. What is the best way to lock the bikes while the vehicle is unattended? I see some racks have locks on the knobs but they don't seem very strong.   What do you suggest? I need to reset my password. I have followed these steps:    However, then I go to "root" or "netroot" recovery options, it tells me:  Give root password for maintenance (or type Control-D to continue)   Clearly, I do not know the root password. If I type CTRL+D, I return to the list of options. From  I read:  Under chapter 'The Other Way':  4. Highlight the line that begins kernel and press 'e' to edit`   But in the grub configuration file I have no line that starts with kernel. Only:  setparams 'Ubuntu...' recordfail set gxfpayload... insmod part_msdos insmod ext2 set root=... search --no-floppy... linux /boot/vmlinuz-2.6.38... initrd /boot/initrd.img-2.6....   Those are all lines in my GRUB. Which line should I edit? Or is there another way to reset my password? How to create a color of the same brightness and saturation? Let's consider three colors: Red, Green and Blue. For blue I created a specific shade, something like #F2F5F7. If you see this color, it has a certain level of shade, brightness and saturation value of blue.  I want to create the same equivalent color but for Green and Red, how to get that? I know the minimum number of reference letters required at many U.S. PhD programs in the STEM fields is three -- and that it is also not uncommon for someone to submit a fourth letter.  What about a fifth letter?  Would a fifth letter of recommendation be perceived as "too many"? Merge two PDF files containing even and odd pages of a book I have two searchable PDF  documents, say even.pdf and odd.pdf which contain even and odd pages of a book, respectively.   I can decompile each PDF to separate files 001.pdf 002.pdf 003.pdf, et cetera. The question is how to merge them?  They are both even and odd sequences numbered 1, 2, 3. If the numbering in the decompile process with pdftk were different, e.g. 1, 3, 5 for even and 2, 4, 6 for odd instead of 1, 2, 3, 4, I could simply merge them.  Can I do this any other way? Which direction will the yoyo move? Why do database guys go on about normalisation?    What is it? How does it help?    Does it apply to anything outside of databases?