I have to write short script to replace line in file. Some of the lines contains slashes and left square brackets (probably right also).   I know that another delimiter should be used to replace line with slashes.  My code:  sed -i -e "s|${oldLine}|${newLine}|g"   This throws an error because line contains [.   Example String in line to change (oldLine variable):  // List exampleList = [   Example how like should look after change:  List exampleList = [   How to make it works when there are some chars like [  To reproduce:  sed -i -e 's|// List exampleList = [|List exampleList = [|g' test.txt
In my bash script I have an external (received from user) string, which I should use in sed pattern.  REPLACE="&lt;funny characters here&gt;" sed "s/KEYWORD/$REPLACE/g"   How can I escape the $REPLACE string so it would be safely accepted by sed as a literal replacement?  NOTE: The KEYWORD is a dumb substring with no matches etc. It is not supplied by user.
A proof for the inequality $\sum_{i=0}^{t-2}{\frac{1}{t+3i}} \leq \frac{1}{2} $ for all $t \geq 2$ I'm struggling with proving the following inequality: $$\sum_{i=0}^{t-2}{\frac{1}{t+3i}} \leq \frac{1}{2}$$  for all $t \geq 2$. I think it is monotonic non-increasing in $t$, which would suffice.  Thanks in advance! In the same way as you can currently render the active viewport in Open GL? Some aspects of the Workbench renderer look as if they will be very useful for NPR people. I have got a template class as follows:  class MyClass&lt;T&gt; {     T field;     public void myMethod()     {        field = new T(); // gives compiler error     } }   How do I create a new instance of T in my class? How do I show that:  $$\frac{1}{\sin^{2}\frac{\pi}{14}} + \frac{1}{\sin^{2}\frac{3\pi}{14}} + \frac{1}{\sin^{2}\frac{5\pi}{14}} = 24$$  This is actually problem B $4371$ given at this . Looks like a very interesting problem.   My attempts: Well, I have been thinking about this for the whole day, and I have got some insights. I don't believe my insights will lead me to a $\text{complete}$ solution.   First, I wrote $\sin\frac{5\pi}{14}$ as $\sin\frac{9 \pi}{14}$ so that if I put $A = \frac{\pi}{14}$ so that the given equation becomes, $$\frac{1}{\sin^{2}{A}} + \frac{1}{\sin^{2}{3A}} + \frac{1}{\sin^{2}{9A}} =24$$ Then I tried working with this by taking $\text{lcm}$ and multiplying and doing something, which appeared futile. Next, I actually didn't work it out, but I think we have to look for a equation which has roots as $\sin$ and then use $\text{sum of roots}$ formulas to get $24$. I think I haven't explained this clearly.         $\text{Thirdly, is there a trick proving such type of identities using Gauss sums ?}$ One post related to this is:  I don't know how this will help as I haven't studied anything yet regarding Gauss sums. Orthogonal complement examples How to find a 4D vector perpendicular to 3 other 4D vectors? In 3 dimensions it is possible to find a vector c (one of infinitely many) perpendicular to two vectors a and b using the cross product. Is there any way of extending this to 4 dimensions, i.e. given three vectors a, b, and c finding a vector d perpendicular to all of them?  I realize that this can be done by solving the equation system:  dot(a, d) = 0 dot(b, d) = 0 dot(c, d) = 0   and imposing an additional constraint, for instance setting the length of d to or one of its components to 1, but is there a way of doing this that does not involve solving an equation system? Do gravitons interact with each other? I always thought the non-linearity of Einsteins field equations implies that there should be direct graviton-graviton interactions. But I stumbled upon  which argues:     If gravitons exist, then, like photons and unlike gluons, gravitons do   not interact with other particles of their kind. That is, gravitons   carry the force of gravitation but are not affected by it. This is   apparent due to gravity being the only thing which escapes from black   holes, in addition to having an infinite range and traveling in   straight lines, similarly to electromagnetism.   Is Wikipedia correct? If not, why not? And what then are the arguments that there must be graviton-graviton interactions?    (As of this question being asked, the above paragraph has been removed from Wikipedia.) How can I make my laptop boot automatically from the hard drive without having to press F10 each time? Full URL not working with php include Baking IK into FCurves I have an object containing multiple models with several IK.  One model has fcurves (euler rotation only) which gives motor to linked IK models.  What I need is bake/convert all IK animations into FCurves.  Is it possible? I built a desktop computer a couple years back with the following specs:  CPU: Intel  Yorkfield 2.5GHz 6 MB L2 Cache LGA 775 95W Quad-Core Processor BX80580Q9300 Motherboard:  LGA 775 NVIDIA nForce 680i SLI ATX Intel Motherboard Video Card: Two  GeForce 8600GT SCC 256 MB 128-bit GDDR3 PCI Express x16 SLI Supported Video Card PSU: SeaSonic S12 Energy Plus  ATX12V V2.3 / EPS12V V2.91 SLI Certified CrossFire Ready 80 PLUS Certified Active PFC Power Supply Memory: Two G.SKILL 4 GB (2 x 2 GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400) Dual Channel Kit Desktop Memory   Since its inception, the machine has periodically locked up, the regularity having varied over the years from once a day to once a month. Typically, lockups happen once every few days. By &quot;lockup&quot; I mean my computer just freezes. The screen locks up, I can't move the mouse. Hitting keys on my keyboard that normally turn LEDs on or off on the keyboard (such as Caps Lock) no longer turn the LEDs on or off. If there was music playing at the time of the lockup, noise keeps coming out of the speakers, but it's just the current frequency/note that plays indefinitely. There is no BSOD. When such a lockup occurs I have to do a hard reboot by either turning off the computer or hitting the reset button. I have the most recent version of the NVIDIA hardware drivers, and update them semi-regularly, but that hasn't seemed to help. I am currently using Windows 7 x64, but was previously using Windows Server 2003 x64 and having the same lockup issues. My guess is that it's somehow video driver or motherboard related, but I don't know how to go about diagnosing this problem to narrow down which of the two is the culprit.  Additional information re: cooling Regarding cooling... I've not installed any after-market cooling systems aside from two regular fans I scavenged from an older computer. The fan atop the CPU is the one that shipped with it. One of the two scavenged fans I added it located at the bottom tower of the corner, in an attempt to create some airflow from front to back. The second fan is pointed directly at the two video cards.  SpeedFan installation and readings Per studiohack's suggestion, I installed , which provided the following temperature readings:  GPU: 63C GPU: 65C System: 76C CPU: 64C AUX: 36C Core 0: 78C Core 1: 76C Core 2: 79C Core 3: 79C   Update #3: Another Lockup :-( Well, I had another lockup last night. :-( SpeedFan reported the CPU temp at 38 C when it happened, and there was no spike in temperature leading up to the freeze. One thing I notice is that the freeze seems more likely to happen if I am watching a video. In fact, of the last 5 freezes over the past month, 4 of them have been while watching a video on Flickr. Not necessarily the same video, but a video nevertheless. I don't know if this is just coincidence or if it means anything. (As an aside, each night before bedtime my 2 year old daughter sits on my lap and watches some home videos on Flickr and, in the last month, has learned the phrase, &quot;Uh oh, computer broke.&quot;)  Update #4: MemTest86 and 3DMark06 Test Results: Per suggestions in the comments, I ran the MemTest86 overnight and it cycled through the 8 GB of memory 5 times without error. I also ran the 3DMark06 test without a problem (see my scores at ). So... what now? :-) Any further suggestions on what to check? Is there some way to get a stack trace or something when the computer locks like that? Resolution I have never did figure out the particular problems, but based on the suggestions here and elsewhere, I'm presuming it was a motherboard issue. In any event, I recently upgraded my system, buying a new motherbeard, PSU, CPU, and RAM, and that new rig has been working splendidly the past several weeks. I am using the same graphic cards as in the old setup, so I think it's safe to reason that they weren't the cause of the problem. If we have a real valued function $f$ continuous at some point $a$, is it necessarily true that $f$ is Riemann integrable on the interval $[a - \delta, a + \delta]$ if a $\delta &gt; 0$ exists? Enumerate paragraphs and subparagraphs like sections but with letters I'm using pandoc and in my template.tex exists this code to make the paragraphs and subparagraphs to behave like sections.  % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else \let\oldparagraph\paragraph \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \fi \ifx\subparagraph\undefined\else \let\oldsubparagraph\subparagraph \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi   This code generate number like this:  1. chapter  1.1 section  1.1.1 subsection  1.1.1.1 subsubsection  1.1.1.1.1 paragraph  1.1.1.1.1.1 subparagraph   How to change this code to enumerate with letter like this:  1. chapter  1.1 section  1.1.1 subsection  1.1.1.1 subsubsection  1.1.1.1.a paragraph  1.1.1.1.a.a subparagraph Extract substring in Bash Given a filename in the form someletters_12345_moreleters.ext, I want to extract the 5 digits and put them into a variable.  So to emphasize the point, I have a filename with x number of characters then a five digit sequence surrounded by a single underscore on either side then another set of x number of characters.  I want to take the 5 digit number and put that into a variable.  I am very interested in the number of different ways that this can be accomplished. After my online research on the subject, I learnt that, biologically speaking, many scientists believe that there is no such thing as a race. Homo sapiens as a species is only 200,000 years old, which has not allowed for any significant genetic diversification yet, and our DNA is 99.99% similar. I've read statements that there can be more genetic variation inside a racial group than between different racial groups, meaning that, for example, two individuals from the same "race" can have less in common with each other than with an individual from another "race".  :     Scientists consider biological essentialism obsolete, and generally discourage racial explanations for collective differentiation in both physical and behavioral traits     Q1: If Homo sapiens has no races (according to biologists), why are we so different morphologically? (hair/eyes/skin colour and even athletic performance seem to differ between human populations)  Q2: Is it common for other species too, when genetically close populations have very different morphological traits? Are there any other mammal or animal species that exhibit biological diversity comparable to human diversity, and how do taxonomists treat these species? (excluding intentionally bred domestic species to keep the comparison fair)    The question has been paraphrased to emphasize that it is the biological debate that is in question, not the sociopolitical. I.e., why is there no consensus in evidence and opinions of scientists? failed to get D-Bus connection: Operation not permitted I'm trying to list services on my CentOS image running in Docker using  systemctl list-units     but I get this error message:  Failed to get D-Bus connection: Operation not permitted   Any suggestions what the problem might be? nginx open reverse proxy? Can't login with Google on recently released iPhones and iPads I just switched from an iPhone 7 to an iPhone XR (both are on latest iOS version available).  When I try to login into the Stack Exchange app with my Google account it says:     Request failed   Could not perform this request with your account. Please try logging   back in. If this persist, let us know on meta.   this happens consistently.  I have 2FA enabled on my Google account if it matters.  Is this a known bug? Let $R$ be a finite ring with unity. Prove that every nonzero element of $R$ is either a unit or a zero-divisor. Scatterplot with too many points