What are the main differences between composition and inheritance?
Difference between Inheritance and Composition
sed append after a line containing multiple unordered strings I'm trying to use sed to append appendstring after a line that contains both Hello and World.  Hello something here World World fsf Hello   This works if I do consider order:  sed -i '/Hello*World\|World*Hello/a appendstring' file   But if I have many strings to match and they are not in order, this is definitely not effective.  Then I tried solutions from another link which discussed deleting a line that contains both strings without considering their order.     However,  sed -i '/Hello/!b;/World/d' file   This does not even work for deletion.   The following one, also one of the answers to that question:  sed -i '/Hello/{/World/d}' file   works, so I tried to implement it to append. Using:  sed -i '/Hello/{/World/a} appendstring' file   But received error:  sed: -e expression #1, char 0: unmatched `{'   Update: The post in the link stated the solution with !b, and it was not working in cshell because of the exlamation mark, but it is working in sh and bash. And it can also be easily extended to inserting many lines when running sed inside a script and the appending a large paragraph.  sed -i '/Hello/!b; /World/a \ addline \ addanotherline ' file I have a JavaScript widget which provides standard extension points. One of them is the beforecreate function. It should return false to prevent an item from being created.   I've added an Ajax call into this function using jQuery:  beforecreate: function (node, targetNode, type, to) {   jQuery.get('http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value),    function (result) {     if (result.isOk == false)          alert(result.message);   }); }   But I want to prevent my widget from creating the item, so I should return false in the mother-function, not in the callback. Is there a way to perform a synchronous AJAX request using jQuery or any other in-browser API? When I am in texture mode one of my objects looks like it is in solid mode. The model is textured like all other models in the scene, but it doesn't look like it is in texture mode.  Screenshot will explain better:      What this model looks like. What all models should look like in texture mode. Probability of student passing an exam There're $25$ tests, each with $2$ questions. There're total of $50$ different questions (the questions do not repeat). The student knows the answer of $44$ questions. To pass the exam, the student needs to correctly answer both questions on the first test he drew, or answer $1$ question from the test he drew first, and $1$ question from the test he drew second. (meaning he draws twice if he answers a question incorrectly on his first try)  What is the probability that the student will pass the exam?  I have never faced a problem like this one so any help is appreciated. I was thinking about approaching it "manually" with some applied combinatorics but I feel like there's a much easier way that I am not familiar with. Voting on Meta sites generally express agreement and disagreement with a proposal, unlike on the Q&amp;A sites where they indicate useful/good vs. non-useful/bad content.  It seems to me that a down-vote on Meta Stack Exchange should not carry a -1 rep penalty, which only discourages down-voting. With this discouragement, questions on Meta SE will be biased towards agreement, since for every up-voter, there may be several in disagreement who don't want to lose the rep for down-voting.  Can the penalty for down-voting on Meta SE be removed? A number of times I have asked a certain kind of ‘attractive nuisance’ question – that is, one in which I anticipate a certain kind of answer would be given that I already know I am going to find insufficient or entirely inadequate. Some examples:      A more abstract example would be asking ‘is it possible to do this 100% correctly’, where people itch to come up with hacks, workarounds and half-baked solutions of various degrees of robustness – while the point of the question is obtaining a fully correct and reliable solution.0 I try to be very explicit in the question body about what kinds of answers I am not interested in. And yet, every time I ask such a question, someone gives such an answer anyway, or an outright XY-type, i.e. frame-challenge answer – where in fact the framing of the question is exactly how I want it, and I don’t want it challenged. Since I have already said in the question body that such an answer would be inaqeduate, when I get one, I downvote it. I believe it’s only appropriate, but it tends not to be received very well – I get insulting comments and downvotes in retaliation. I realise that a proper answer would be much harder to come up with than an ‘obvious’ inadequate answer. I suspect that often a real answer should be negative: ‘there is no way to do that’ or ‘there is no way to answer that for sure’. Nevertheless, if that is the right answer, this is the one I want posted – I don’t want the Internet polluted with more tumbleweed of what is already well-known (and may even be subtly wrong), and I don’t want to give ‘A for effort’ upvotes. What is the most appropriate way to act in such a situation?  0 I am also reminded of when Gary Bernhardt  while trying to avoid reflexive ‘don’t use eval’ replies. Of course, expecting nuance from Twitter of all places is silly, but that’s beside the point. can u suggest me any short trick of solving these kind of problems. How to find last four digits of any number raised to some power ? How does the propagation of gravity work for photons? Getting raw SQL query string from PDO prepared statements Is there a way to get the raw SQL string executed when calling PDOStatement::execute() on a prepared statement? For debugging purposes this would be extremely useful. Creating a virtual microphone GTA 5 Social club I used to play gta 5 online on my ps3 but it ended up breaking and I can't use it anymore I purchased the game for xbox 360 and started playing the game all over again and some of you know how hard that can be specially online.. So I was wondering if I could somehow transfer my old ps3 social club account to my xbox an use it on xbox from now on? Pathologies in module theory Linear algebra is a very well-behaved part of mathematics. Soon after you have mastered the basics you got a good feeling for what kind of statements should be true -- even if you are not familiar with all major results and counterexamples.  If one replaces the underlying field by a ring, and therefore looks at modules, things become more tricky. Many pathologies occur that one maybe would not expect coming from linear algebra.  I am looking for a list of such pathologies where modules behave differently than vector spaces. This list should not only be a list of statements but all phenomena should be illustrated by an example.  To start the list I will post an answer below with all pathologies that I know from the top of my head. This should also explain better what kind of list I have in mind. So, if we have a large pipe which is constricted in the middle, the fluid in the middle section  will move faster. Why is it so? What dictates that liquid that an X amount of it must pass on the other side regardless of the size of the encasement?  The only reason I could think about is because that the initial pressure which causes the movement somehow is being transferred to a smaller area, but that makes no sense. I have been thinking of getting a flash to improve my low light photography (particularly indoors). However, there seem to be a number of different models available at similar price points (budget of INR 8,000-12,000 ~$150-250). What features and functionality should I look for to choose a suitable flash?  I'm using a Canon 550D with the 18-55mm IS &amp; 55-250mm IS lenses. Metz seems to be one of the brands easily available in India (beside the OEM flashes). Currently, I am considering the Metz 36 AF-5, 44 AF-1 and 50 AF-1, which seem to be considerably cheaper than their Canon counterparts. Is there an irrational number $a$ such that $a^a$ is rational? It can be proved that there are two irrational numbers $a$ and $b$ such that $a^b$ is rational (see ) and that for each irrational number $c$ there exists another irrational number $d$ such that $c^d$ is rational (see ).  My question is: Is there an irrational number $a$ such that $a^a$ is rational (and how could you prove that)? Upgraded to 13.10 now clock settings are all disabled and clock does not display I've upgraded to 13.10 and now I don't have the standard menu clock, which I need for work.  I checked and 'indicator-datetime' is installed.  I even uninstalled/reinstalled that applet with no luck.  Also my "clock" settings under System Preferences are all disabled.  I can't change anything.  Does anyone know how I can get the old menu clock back?  Alternatively is there another menu clock app I can download?  Edit 1  Thanks for the responses    I've restarted several times and that didn't fix the issue. I just ran the 13.10 update today.  But I ran it again a few minutes ago.  I got   about 200KB in random updates.  The issue is still present after a reboot. # apt-cache policy indicator-datetime indicator-datetime: Installed: 13.10.0+13.10.20131016.2-0ubuntu1 Candidate: 13.10.0+13.10.20131016.2-0ubuntu1 Version table: *** 13.10.0+13.10.20131016.2-0ubuntu1 0     500 http://us.archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages     100 /var/lib/dpkg/status   Edit 2  I believe the issue is related to 'rarings' changing the systray somehow...   Or , although I haven't got that solution to work yet.  Edit 3  Because of a suggestion from RolandiXor I've check the binaries.  My system is missing 'libical.so.0' but it has 'libical.so.1'.    ldd /usr/lib/x86_64-linux-gnu/indicator-datetime-service libical.so.0 =&gt; not found   Does anyone know how to get the libical.so.0 binary that the datetime service needs but doesn't install? Why is plain-hash-then-encrypt not a secure MAC? Installing QGIS with ECW support on Mac? Text won't appear in interface? There is one problem, it seems that text won't appear on my program. The three images show the errors and also my laptop specs (I believe I just have very small amount of laptop power that makes Blender glitch).  Everything else works fine (zooming, panning, rotating, etc.) and the buttons are still there and do what they're supposed to do, but the text just won't appear.  Might anybody know how to fix this?        The drive update didn't help either. I know a way around it though, does anybody know a page which shows screenshots of more or less the buttons on blender More examples of Simpson's Paradox, barring the ones on Wikipedia, Titanic, and delayed flights. I hope someone may know fresh examples of  for use in my statistics courses.  The examples I've been using are fine, but I'd like to have some new ones.  I'm familiar with the ones on the Wikipedia page: the gender bias lawsuit at Berkeley, batting averages, mortality rates among low birth babies, party voting on the Civil Rights Act, and success rates of kidney stone treatments.  I'm also familiar with the example of survival rates on the Titanic and the one about delayed flights at America West vs. Alaska Airlines.  These are all good ones, but, like I said, I'm looking for more. Does anybody know any others?  For those who aren't familiar with it, Simpson's paradox is essentially a property of unreduced fractions: It's possible to have, simultaneously, $$\frac{a_1}{b_1} &lt; \frac{c_1}{d_1} \text{ and } \frac{a_2}{b_2} &lt; \frac{c_2}{d_2}, \text{ but } \frac{a_1 + a_2}{b_1+b_2} &gt; \frac{c_1+c_2}{d_1+d_2}.$$   For example, $\frac{1}{3} &lt; \frac{34}{100}$ and $\frac{66}{100} &lt; \frac{2}{3}$, but $\frac{67}{103} &gt; \frac{36}{103}$.  It can be hard to spot this happening in a given real-world scenario.