string inputText="lorem impsum dolar sit amet lorem"; string patternText="lorem"; string replacementText="XXXX"; Regex.Replace(inputText, patternText, replacementText, RegexOptions.IgnoreCase);   output:XXXX impsum dolar sit amet XXXX  But how do I make only one change ?  should be such that  : XXXX impsum dolar sit amet lorem
It seems the .NET Regex.Replace method automatically replaces all matching occurrences.  I could provide a MatchEvaluator delegate that returns the matched string after the first replacement, rendering no change, but that sounds very inefficient to me.  What is the most efficient way to stop after the first replacement?
How do you keep parents of floated elements from collapsing? Although elements like &lt;div&gt;s normally grow to fit their contents, using the float property can cause a startling problem for CSS newbies: If floated elements have non-floated parent elements, the parent will collapse. For example:   &lt;div&gt;   &lt;div style="float: left;"&gt;Div 1&lt;/div&gt;   &lt;div style="float: left;"&gt;Div 2&lt;/div&gt; &lt;/div&gt;    The parent div in this example will not expand to contain its floated children - it will appear to have height: 0. How do you solve this problem? I would like to create an exhaustive list of solutions here. If you're aware of cross-browser compatibility issues, please point them out. Solution 1 Float the parent.   &lt;div style="float: left;"&gt;   &lt;div style="float: left;"&gt;Div 1&lt;/div&gt;   &lt;div style="float: left;"&gt;Div 2&lt;/div&gt; &lt;/div&gt;    Pros: Semantic code. Cons: You may not always want the parent floated. Even if you do, do you float the parents' parent, and so on? Must you float every ancestor element? Solution 2 Give the parent an explicit height.   &lt;div style="height: 300px;"&gt;   &lt;div style="float: left;"&gt;Div 1&lt;/div&gt;   &lt;div style="float: left;"&gt;Div 2&lt;/div&gt; &lt;/div&gt;    Pros: Semantic code. Cons: Not flexible - if the content changes or the browser is resized, the layout will break. Solution 3 Append a &quot;spacer&quot; element inside the parent element, like this:   &lt;div&gt;   &lt;div style="float: left;"&gt;Div 1&lt;/div&gt;   &lt;div style="float: left;"&gt;Div 2&lt;/div&gt;   &lt;div class="spacer" style="clear: both;"&gt;&lt;/div&gt; &lt;/div&gt;    Pros: Straightforward to code. Cons: Not semantic; the spacer div exists only as a layout hack. Solution 4 Set parent to overflow: auto.   &lt;div style="overflow: auto;"&gt;   &lt;div style="float: left;"&gt;Div 1&lt;/div&gt;   &lt;div style="float: left;"&gt;Div 2&lt;/div&gt; &lt;/div&gt;    Pros: Doesn't require extra div. Cons: Seems like a hack - that's not the overflow property's stated purpose. Comments? Other suggestions? Why is the accountsd process eating so much CPU? Some examples include:     We fear the damned.   He honored our fallen.   This is a given.   You are the chosen.   The lost were among us.   They obey the venerated.   My beloved kissed me. (TIL “beloved” is a verb thanks to RegDwight АΑA)   Is there a word to describe the past participle used as a noun? I’m hesitant to refer to it as a gerund, since it doesn’t end in -ing. Another possibility is adjectival noun, if you originally treat the word as a participle (e.g. “the damned man”) that has given up its modified noun.  Also, why does English tend to preface such nouns with the? We've drastically simplified the user deletion process! A common mistake for beginning group theory students is the belief that a quotient of a group $G$ is necessarily isomorphic to a subgroup of $G$.  Is there a characterization of the groups in which this property holds?  If this question is too broad, I might ask if such a characterization exists for $p$-groups.    History: I originally posed the opposite question, regarding groups for which $\exists N\unlhd G\,:\, \not\exists H \unlhd G\, \text{  s.t. } H \cong G/N$, and crossposted this to .  I received an answer there to the (now omitted) peripheral question about probability, which shows that most finite groups probably have this property.  After this, I changed the question to its current state, as this smaller collection of groups is more likely to be characterizable. I do as follows  $(1+x)^n= \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+...+\binom{n}{n}x^n$   differentiating in both sides  $n(1+x)^{n-1}= \binom{n}{1}+2\binom{n}{2}x+3\binom{n}{3}x^2...+n\binom{n}{n}x^{n-1}$  then, for $x=1$  $n \cdot2^{n-1} = \sum_{k=1}^{n}k\binom{n}{k}$  From here, I don't know how to proceed, I have tried to multiply both sides for $(1+x)$ to make $n \cdot2^{n}$ but then the summatory changes, I don't know how to prove the equality. Looking for title of a fantasy fiction with huge war, invader on airship with warlock, island fortress with sorcerer, mnemonic storyteller and dragon This was a thick book that I read over fifteen years ago that I never finished reading because someone borrowed it and didn't return it to the school library. I want to find its title.  The story takes place in a kingdom that is preparing for the a cycle of war, where every time the winds changes (50 or 100 years), invaders will try to cross the sea from another continent using airships with air balloons, filled with soldiers and warlocks. The kingdom has made several man-made island fortress along their coastline, filled with soldiers with war machines, sorcerers, and enchanters who act as the main guard/defence for the kingdom, calling lightning and fireballs, and using machines to stop and destroy and bring down as many of the invader airships as possible while countering the warlocks on board.  The book involved a man and a girl whose journey brought them apart in preparing for the imminent war.   The women found herself adept in magic and went to the academy in the capital to learn to be a sorceress.   The man found a different calling. With a good memory, he was sent to learn to become a mnemonic storyteller (to train with battle staff and fighting skill and mnēmonikos skill) who carried the history, literature of the entire culture in their heads. They used their knowledge to convey the kingdom's literature, poetry, history and stories to the people from generation to generation.  Both eventually "graduate". Sadly, and with great emotion, both have to part ways. She was sent to a fortress island and began her role as a sorcerer who will stand guard there. He, as a storyteller, began his own journey without her, going from town to town, village and soldier barrack, across the kingdom, telling stories of great men and their deeds, and courageous heroes who fought the war, to uplift the spirit of the people and bring valor to the soldiers stationed at the border and people in the coming war.   In brief, he meets a dragon (who used to be involved in the war in ages past), long thought to be extinct. He finds himself able to communicate with it and has a "born" friendship with it. The dragon teaches him to become a "dragon rider", a long-lost ability of his people (due to the "extinction" of dragons.)   The wind changes with the dread of war hanging on the kingdom.  Airships start to blacken the sky again with soldiers and war machines battling each other. setting up subdomain on ubuntu server Adding console.log to every function automatically Why did the Ministry of Magic choose an ax for carrying out a death sentence? What, exactly, is transferred along supply lines? Supply routes are great when a settlement is just starting out to get things off the ground, but what is specifically transferred along them? I know anything on the  Junk, Aid and Mods tabs are transferred, and Fusion cores and Power Armor pieces aren't. Does that mean weapons, armor and ammo aren't transferred at all?  And what about Food and Water resources? Can I build a farming community with a surplus of food and use that to feed a merchant-only settlement, or are local crops always required? Ditto water. I just reinstalled my Ubuntu system with 11.10, but ran into a problem when I tried to install Gimp 2.7.  I always get unmet dependencies (it's german, so I can't tell you the exact english translation):     Needs gimp-data (&lt;= 2.6.11-z) but 2.7.3-2011082002~oo should be installed   I already read the follow post, but the answers didn't really help me.  When I type in     sudo apt-get install gimp=2.6   it just says that there is no version 2.6 found. I get the same with 2.7.  I really need Gimp. But installing Gimp 2.6 isn't possible as well.  When I remove the repos for 2.7, I still get the same error. Is it possible to make the default scene fill two monitors at startup? I know how to set up the default scene by pressing Ctrl+U, but whenever I startup Blender it always fills only one of my screens, even if I set it to fill both before setting the default scene. I end up having to resize it every time I start it up. Is there a way to set this to happen by default? Until now, I have been compiling my LaTeX documents with pdfLaTeX. My standard document preamble includes the "usual suspects" for non-English speakers (, , ) and a bunch of other packages. Assuming I were to convert to XeLaTeX, what modifications of my preamble are advisable? I'm aware that the expansion=true option of the  package is not (yet) available for XeLaTeX, and that  is sort of a default package for OpenType fonts. What other packages (and package options) should be removed and, vice versa, incorporated when switching from pdfLaTeX to XeLaTeX? How to force GPG to use console-mode pinentry to prompt for passwords? Getting the array length of a 2D array in Java Solve $\int_0^{+\infty} \Big(\frac{\sin t}{t}\Big)^2 \ dt$ utf8 and ISO 8859-1 encoding references trouble I have to use one particular template ( am obliged to use it for my thesis) it uses \bibliographystyle{plain} Ihave both english and frensh text on it (for abstract and résumé) there is no problem for characters like ( é, ç...) but some of references does not appear they are replaced by [?] knowing that foe encoding \RequirePackage[latin1]{inputenc} how to fix this problem please!   \documentclass{article}   \RequirePackage[latin1]{inputenc}   \RequirePackage{fancyhdr}     blabla \cite{nayak2015comprehensive, byun2002applications, shah2004sequential, fletcher2009support, cornuejols2011apprentissage, byun2002applications}   @article{nayak2015comprehensive,    title={A comprehensive survey on support vector machine in data mining     tasks: applications \&amp; challenges},    author={Nayak, Janmenjoy and Naik, Bighnaraj and Behera, HS},    journal={International Journal of Database Theory and Application},    volume={8},    number={1},    pages={169--186},    year={2015}    }      @inproceedings{shah2004sequential,     title={Sequential k-nearest neighbor pattern recognition for usable      speech classification},     author={Shah, Jashmin K and Smolenski, Brett Y and Yantorno, Robert E      and Iyer, Ananth N},     booktitle={Signal Processing Conference, 2004 12th European},     pages={741--744},     year={2004},     organization={IEEE}     }      @misc{fletcher2009support,      title  = {Support vector machines explained},     author = {Fletcher, Tristan},     journal= {University College London, London},     year   = {2009},     howpublished = "\url{http://sutikno.blog.undip.ac.id/files/2011/11/SVM-     Explained.pdf}",     note   = {Accessed: 2017-04-30}     }      @inbook{cornuejols2011apprentissage,      title={Apprentissage artificiel: concepts et algorithmes},      author={Cornu{\'e}jols, Antoine and Miclet, Laurent},      year={2011},      pages={279--309},      publisher={Editions Eyrolles}       }      @incollection{byun2002applications,      title={Applications of support vector machines for pattern recognition:       A survey},      author={Byun, Hyeran and Lee, Seong-Whan},      booktitle={Pattern recognition with support vector machines},       pages={213--236},      year={2002},      publisher={Springer}      }    \end{document}  knowing that my references work well on other template but this one no how to fix this problm please! here is the error I got   Edited here is the link to the template  in fact I have created a littele example ( since I could not publish my thesis ...) the error has disappeared but my references still [?] How do you mock a Sealed class? can be quite a pain.  I currently favor an  to handle this, but something about just keeps feels weird.    So, What is the best way you mock sealed classes?  Java answers are more than welcome.  In fact, I would anticipate that the Java community has been dealing with this longer and has a great deal to offer.  But here are some of the .NET opinions: I've seen papers (e.g., in Science) where the first two authors are listed in non-alphabetical order, and yet there are asterisks behind their names to say that they contributed equally.   It seems strange to me, because if the two authors are in alphabetical order, then it could be that the first author contributed more or the two contributed equally, and this can be made clear with asterisks in the paper if it's the latter case. When they're in non-alphabetical order, however, if someone only sees the author list without seeing the paper, he/she will likely assume that the first author contributed most.  So my question is: Are there particular reasons why people do that? (This  is related, but I don't think the answers there get to my question.)