This question was part of the problem set for PROMYS Europe 2020, a maths (or math, just in case I made anyone unhappy) camp held at Oxford every year. It was the one which I couldn't do, and I am still puzzled by it to this day: The Mathematical Forest is grown in a two-dimensional plane, where trees can only grow on points with integer coordinates. To start with, there are no trees at all. The foresters plant the first tree at (0, 0). Each year, they carry out tree planting according to the following rule. If there is a tree on the point (m, n) but there are no trees on the points (m + 1, n) and (m, n + 1), then they can choose to remove the tree on (m, n) and plant new trees on the points (m, n + 1) and (m + 1, n). For an integer k ≥ 1, the kth diagonal consists of all points (m, n) with m + n = k − 1. Is it possible for the foresters to arrange their planting so that eventually there are no trees on the first 2 diagonals? What about the first 3 diagonals? 4 diagonals? Can you generalize? P.S. The deadline has already passed, so please do not think that I am cheating! The camp was actually cancelled due to obvious reasons, which sucks, because I really looked forward to going.

This question has been asked before, at least twice by people who were trying to cheat on the PROMYS Europe 2020 Application, and once in a  because the OP showed no effort. I haven't been able to solve it, so I'm going to to ask it again.  PROMYS applications have closed, and I hope the effort shown below is enough to keep this question from being closed.     The Mathematical Forest is grown in a two-dimensional plane, where   trees can only grow on points with integer coordinates. To start with,   there are no trees at all. The foresters plant the first tree at   $(0,0)$. Each year, they carry out tree planting according to the   following rule. If there is a tree on the point (𝑚,𝑛) but there are   no trees on the points $(m+1,n)$ and $(m,n+1)$, then they can choose   to remove the tree on $(m,n)$ and plant new trees on the points   $(m,n+1)$ and $(m+1,n)$. For an integer $k\geq1$, the $k$th diagonal   consists of all points $(m,n)$ with $m+n=k−1$. Is it possible for the   foresters to arrange their planting so that eventually there are no   trees on the first $2$ diagonals? What about the first $3$ diagonals?    $4$ diagonals? Can you generalize?   It's easy to get to a position with no trees on the first two diagonals.  (It only takes $4$ plantings.)  I can prove it's impossible to reach a position with no trees on the first $4$ diagonals, and I believe it's impossible to reach a position with no trees on the first $3$ diagonals, but I can't prove it.  For the $k=4$ case, I used a pagoda function, as in a peg solitaire problem.  For $k=1,2,3,\dots$ define the potential of a tree on the $k$th diagonal as $\frac1{2^{k-1}}$, and the potential of the forest as the sum of the potentials of all the trees in it.  When a tree of potential $\frac1{2^{k-1}}$ is removed, it is replaced by $2$ trees of potential $\frac1{2^k}$ so the potential of the forest never changes.  Initially, the potential of the forest is $1$.  Since there are $k$ trees on diagonal $k$, the potential of all points beyond the fourth diagonal is $$\sum_{k=5}^\infty\frac k{2^{k-1}}=\frac34<1,$$ so it is impossible that there are no trees on the first $4$ diagonals.  The potential of the fourth diagonal is $\frac12$, so this argument doesn't show that it's impossible to have no trees on the first $3$ diagonals.  I've done a lot of experimenting, though, and I believe that the statement is true.  (I even wrote a little computer game so I could experiment quickly.)  The best I've been able to do is to get down to one man on the third diagonal.   The black circles are trees eligible for removal, and the gray circles are other trees.  You can see that there is a "traffic jam" in front of the lone tree on diagonal $3$, and there seems to be no way to clear it.  I've been trying to come up with an argument that reflects this traffic jam, but I haven't been at all successful. We know that after $n$ removals there are $n+1$ trees, and I've been trying to prove somehow that they can't all be sufficiently far from the origin to allow all trees to get past diagonal $3$, but I haven't come close.   In the diagram above, if the tree at $(1,1)$ were moved to $(0,2)$, and the tree at $(1,2)$ were moved to $(2,0)$, then it would be possible to remove the tree at $(0,2)$, emptying the second diagonal.  In the fictitious position, we still have one tree on diagonal $2$ and two on diagonal $3$.   So, I think an argument along the lines I was trying cannot just be concerned with the distance from the origin; it must somehow take into account how the trees interfere with one another.  I haven't been able to do this.    I'd be grateful for solutions, hints, or counterexamples.  I wasn't really sure what tags to attach.  Please add any that seem appropriate.


I am currently writing my statement of purpose (SOP) for top graduate schools in engineering majors in US. I am wondering should I include name of my potential advisor on my SOP (Is it a good idea to do that)? The problem is I am thinking if I do not include name of advisor it might be the sign I did not look at his/her research page and I am not very specific about my plan. On the other side, if I include name of potential advisor and my application is not competitive or he/she is not accepting any graduate student this might cause others not to look at my application since they might think I am not interested in their research.

For PhD applications, I have mentioned that I am interested in some research areas. Besides, I am thinking about mentioning some professors' names, so that it shows I have read their websites and I am not just sending out generic statements applicable to many schools.  But is it good to mention some professors' names in the statement of purpose, if I don't know them personally? In what cases is it good, and in what cases it isn't?  For example, is it good to only mention    those whose research directions are aligned with my research interests, or/and those whose books or notes I have heard of, or better, might have read some parts of, or/and those who are already established and famous (such as having certain titles), or/and those that are directing the PhD graduate programs, or/and those that are heads of the departments?    What will other professors who are not mentioned think? How will you do, if it were you?


Consider a linearly ordered set $(X; \prec)$ with its order topology.   Show that closure of $(a;b)$ is a subset of $[a;b]$. Under what conditions does equality hold? Give an example of a strict inclusion.   I  solves part 1:  $$[a,b]=X \setminus((−\infty,a)∪(b,+\infty))$$ is closed and contains $(a,b)$ , so it contains the closure of $(a,b)$.  Furthermore, it equals the closure iff both endpoints are limit points of the interval.  But I cannot find example for strict inclusion.

a question from my h.w.:  Let $(X,<)$ be a totally ordered set. Lets examine $X$ with the order topology. a. Prove that $\overline{(a,b)} \subseteq [a,b]$ (where the overline denotes closure of the set). Give an example where the inclusion is strict. b. Give necessary and sufficient conditions such that $a\in\overline{(a,b)}$ and such that $b\in\overline{(a,b)}$  So I've managed a. easily enough. I think a proper example of strict inclusion would be a finite set - say $\{1, 2, 3, 4, 5\}$ with the obvious order. Then $(2,4)=\{3\}$ so indeed $ \overline{(2,4)} = \{3\}$ and not $[2,4]$. I'm stumped about the conditions though. Can anyone give me some help? Thanks!


Many will be familiar already with the technical details of when to use 'I' and 'me' in a sentence. I hit him, he hit me, etc. What I'm confused about is cases such as "me and John went to the shops". Or "who went to the shops earlier? Me and John did." It's often desirable to list one's self first, either to be emphatic about one's own role in what is being said, or to give one time to think about who else was involved. These appears to be cases where one cannot change the word "me" to "I" without also changing the word order. For example, you can't say "I and John went to the shops", it has to be "John and I went to the shops". Is this a formally-recognised case in which "me" can be used in place of "I" (that is, when listing a series of names where the speaker is mentioned first in the list), or does it amount to formally "incorrect" usage despite being almost universal in speech? To be clear for those who insist this has already been answered, I'm not looking for an explanation of the general rules about I and me. In the specific case where one's self is referred to first in the list, the de facto correct formulation is to say "me and John went to the shops", not "I and John went to the shops". I think we can all agree that the former is actually correct in practice, and the latter is incorrect. My question is whether this is recognised formally as an exception to the usual rule about I and me?

From some comments in the answers for  (now deleted, 10k only), there's confusion around the usage of I vs. me:  While the sentence, "the other attendees are myself and Steve," is agreed to be incorrect, there's confusion about whether the correct form is "the other attendees are me and Steve" or "the other attendees are Steve and I."  (I've always used the heuristic of removing the other people from the sentence, so I always thought "the other attendee is me" would be correct, instead of "the other attendee is I." Is this true, or am I using a flawed heuristic?)


If I perform .Select() on a collection, will the resulting collection share exact index values between the two collections.  Perhaps I haven't explained myself well. Here's what I mean:  int[] nums = new int[]{ 50, 100, 200};  var moreNums = nums.Select(num => num / 2);   Will moreNums[0] = 25? [1] = 50? [2] = 100?  Can you bank on this, 100% of the time? I always feel a sense of ambiquity with LINQ because of this. This is important because I have two lists where I can use a single index to refer to a pair of values between the two lists. I don't want my lists to go out of sync.

I use LINQ to Objects instructions on an ordered array.  Which operations shouldn't I do to be sure the order of the array is not changed?


Why does a black body emit at all frequencies at thermal equilibrium?

The resources that I've checked out seem to say thermal radiation only occurs in the infrared and visible spectrum. For example my heat transfer textbook and the Wikipedia page on .  In my mind thermal radiation is just energy emitted as a result of internal collisions from temperature. So, since temperature can range from 0K to huge numbers, I would think you would have a similar range of emitted energies. So then thermal radiation could occur throughout the whole of the electromagnetic spectrum.


I am creating a presentation in LaTex using the beamer document class. I am using the Hannover theme. This produces a navigation bar on the left hand side of each slide.  I have a lot of sections and subsections. These are indicated on the navigation bar. The problem is that these overflow the navigation bar. Neither do I want to delete any section or subsection nor do I want to make the text in the navigation bar smaller.  But still, I want the navigation bar to show all the "relevant" sections and subsections (along with the previous and next ones). How do I achieve this?  Edit 1  Here's an MWE (a screenshot of how the navigation bar looks like when there are too many sections and subsections):   As you can see, the navigation bar is overflowing. I do not want this to happen. Instead I want the following to happen:     Whenever I am presenting a section, only that section (and it's   subsections along with the name of the previous and next section only)   must be displayed on the navigation bar - nothing else. If I move onto   a next  section, only this section (and it's subsections along with the   name of the previous and next section only) must be displayed on the   navigation bar - nothing else.   How can I make this happen?

I make a translation of a 600 pages Book with the beamer class in Latex, so I have lots of Subsections and SubSubsections. I want to show all subsections of the current Section in the sidebar along with all the subsubsections of the CURRENT subsection. I came across a hint and made   \setbeamertemplate{subsubsection in sidebar shaded} {\vspace*{-\baselineskip}}   But that just hides all subsubsections but the current one. The best solution would be something like  \setbeamertemplate{subsubsection in sidebar shaded}[subsubsectionstyle=show/shaded/hide]   or any other way i can change the subsubsectionstyle. The best idea I had was   \setbeamertemplate{subsubsection in sidebar shaded} {\tableofcontents[subsubsectionstyle=show/shaded/hide]}   But that just creates over 3000 errors and didn't solved my problem . Is there anybody who has an idea to solve this Problem ?  Here is a MWE to show what i mean:      \documentclass[9pt]{beamer}  \usetheme[hideothersubsections]{Goettingen}  \begin{document}  \section{Section 1} \begin{frame} \frametitle{Section 1} \end{frame}  \subsection{Subsection 1.1} \subsubsection{SubSubsection1.1.1} \begin{frame} bla \end{frame} \subsubsection{SubSubsection 1.1.2} \begin{frame} bla \end{frame}  \subsection{Subsection 1.2} \subsubsection{SubSubsection1.2.1} \begin{frame} bla \end{frame} \subsubsection{SubSubsection 1.2.2} \begin{frame} bla \end{frame}  \section{Section 2} \begin{frame} \frametitle{Section 2} \end{frame}  \subsection{Subsection 2.1} \subsubsection{SubSubsection2.1.1} \begin{frame} bla \end{frame} \subsubsection{SubSubsection 2.1.2} \begin{frame} bla \end{frame}  \subsection{Subsection 2.2} \subsubsection{SubSubsection2.2.1} \begin{frame} bla \end{frame} \subsubsection{SubSubsection 2.2.2} \begin{frame} bla \end{frame} \end{document}   And one page of the output is:   As you can see, with the option [hideothersubsections] in  \usetheme[hideothersubsections]{Goettingen} subsections outside the current section are not shown in the sidebar. I want the same effect for the subsubsections with regard to subsections. So Subsubsection1.2.1 and SubSubsection1.2.2 should not be seen in the sidebar, because im in subsection 1.1  Therefore it should looks like this:   And when my slides move on and the subsections changes (from subec 1.1 to subsec 1.2), then the displayed subsubsection shall also change. It then should looks like this:   Of course the space between subsec 1.1 and subsec 1.2 should disappear.


I am using the package  in a paper. When I use the package like this example:  \documentclass[12pt]{book} \usepackage{lipsum} \usepackage{bookmark} \usepackage{utdiss2} \usepackage{hyperref} %\usepackage{appendix}   \begin{document} \chapter{Ch1} \lipsum \chapter{Ch2}  \lipsum  %\bookmarksetupnext{level=part} \begin{appendices} \chapter{Hello} \lipsum \chapter{World} \lipsum \end{appendices} \end{document}   Eveything's OK, but the PDF does not have a correct matching in bookmark.  The first appendix matches to Chapter 1, not the first appendix.     I looked into the appendices environment in the utdiss2.sty package and commented out \setcounter{chapter}{0}.   \def\appendices{\clearpage     \typeout{Appendices.}     \short@page \setcounter{regular@short}{1}   % <- 9/13/96 (MAL)         \markboth{}{}\pagestyle{myheadings} % <- The appendices must         \thispagestyle{plain}           % <- be numbered.     \vspace*{\fill}     \centerline{\large\bf Appendices}     \vspace*{\fill}      \addcontentsline{toc}{chapter}{Appendices}  % <-      \setcounter{chapter}{0} % <---     \setcounter{section}{0}      \def\@chapapp{\appendixname}     \chap@or@app=2     \def\thechapter{\Alph{chapter}}}   Now, the bookmark works fine, but the numbering is wrong; Appendix C and D instead of Appendix A and B.   Without the utdiss2.sty package, there is no problem, so there is something changed in this package.     What might be wrong? What might be causing this kind of issue (wrong bookmark mapping) when redefining appendices or chapters?

The following MWE produces a PDF whose TOC has two entries: “Foo” and “Bar” with correct page numbers. So far, so good. However, upon clicking on the link to “Bar”, I am taken to the page for “Foo” instead.  \documentclass{report} \usepackage{hyperref} \newcommand*\backmatter{\setcounter{chapter}{0}}  \begin{document} \tableofcontents \chapter{Foo} \backmatter \chapter{Bar} \end{document}   (Produced with pdflatex, run twice.)  This MWE is whittled down from a (much!) more complex document but the above does seem to reproduce the error reliably.  Re-setting the chapter count seems to confuse hyperref, even though the page references are still accurate. Notice that in my real document, \backmatter does other things, including setting the numbering style to alphabetical so there’s no chance of confusion even though both chapters are ostensibly labelled as “Chapter 1”.  How do I fix this? Is this a bug? Are there workarounds?


Is there any easy way to resample 30 meter NDVI from Landsat 8 images to 5 metres?  I use raster to point and the interpolation of point to raster using Kriging method.   I know that it may not be a proper way of  getting 5 m NDVI but for the purpose of demonstration I need to do.

I have NDVI images (250 m) and Soil map (1000 m).   How can I change the resolution from 1000 m to 250 m, so I can compare/work with them?


I want to tell a professor that I can not attend the meeting because it is at the same time as my class and ask them to change the meeting time. My question is, what is the correct word to use rather than "interfere" or "overlap"?  The time you gave me for the weekly check-in meeting interferes/overlaps with my X class, which starts at 11:30. Can I come at a different time?  Also, I am using "The time you gave me" because it is a long meeting with different students, and each student is given a specific time to go. If you have a better suggestion for that, that would be great too.

For example, I need to enroll in two different courses at university, but there is a schedule in which both are held.  Is it an 'overlapped schedule' or something similar? Is there a proper expression for this purpose?


I'm getting the Cannot save _____ Unexpected error: Error renaming temporary file: Text file busy  in Gedit 2 when I try to save in a shared folder with Virtualbox (Debian). I've searched and apparently it's a Gedit problem. None of the solutions seem ideal or work for me. Would it be possible to create a shell script (external tools plugin) that saves the file somewhere else, then copies it back in shell? So I'll need to grab wherever Gedit's stored the temporary (live?) file. Or if this is not possible/won't work/bad practice, does anyone know a good way to get around this? I really like Gedit and prefer to use it.  Currently, this is my script. I tell external tools not to save but pass the document as input (stdin) bin="" while read LINE; do     echo ${LINE}    # do something with it here     bin="${bin}${LINE}\n" done  echo $bin > /home/me/data2/test.txt  It works fine except it doesn't preserve tabs. I'my only editing plain text files. Edit: this also seems to skip the last line

I have a text file that I can change using other applications (for example openoffice).  But when I try to change and save it using gedit, I am getting error from gedit:  Could not save the file /media/sf_Ubuntu/BuildNotes.txt. Unexpected error: Error renaming temporary file: Text file busy   the permission of BuildNotes.txt is as follow:  -rwxrwx--- 1 root vboxsf  839 2012-10-26 12:08 BuildNotes.txt   and user id is:  m@m-Linux:/media/sf_Ubuntu$ id uid=1000(m) gid=1000(m) groups=4(adm),20(dialout),24(cdrom),46(plugdev),105(lpadmin),119(admin),122(sambashare),1000(m),1001(vboxsf)   What is the problem and how I can fix it?


Is there such a program like wine, but one that runs Mac / OSX .app(s)? I would find it very interesting to run mac .apps and see the result on such a program.

Just wondering, are there any projects like WINE, but for Mac software? That is, can we use a program that acts like a compatibility layer to run Mac apps?


I am located in Israel, and would like to access the American Google home page and "Doodle". Even when I choose the "google.com" option on the google.co.il page, the US page it takes me to does not display any of the "doodles" currently on display in the US. Any ideas how I can fix this?

I live in the UK, and whenever I visit google.com I am redirected to google.co.uk, but I want to see my website's rankings on the US version (I presume the results are different). Is there a way to do this?


I'm trying to execute a sed command with "-n" option.  for i in 1 2 3 4 5 ; do maas maas nodes list | grep hostname | cut -d\" -f4 | sed -n '$ip'; done   I want it to run  sed -n '1p' then sed -n '2p' and so on.  Any idea?

I tried the following code to replace QQ with ZZ, but it doesn't do what I want:  var1=QQ sed -i 's/$var1/ZZ/g' $file   However, this code does what I want:  sed -i 's/QQ/ZZ/g' $file   How do I use variables in sed?


When I try to use  sudo apt-get update   it gives this error:  Fetched 5.530 kB in 53s (104 kB/s) W: GPG error: http://extras.ubuntu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192 W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file) E: Some index files failed to download. They have been ignored, or old ones used instead.   When I try to access to etc/apt folder, it said no such file or directory.    How can I fix this?

I added some extra repositories with the Software Sources program. But when I reload the package database, I get an error like the following:     W: GPG error:  trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8BAF9A6F   I know I can fix it using apt-key in a terminal, according to the official Ubuntu documentation. But I would have liked to do it graphically. Is there a way to do this without using a terminal?


I split the full data into training and test set in 80:20 ratio. Then within the training set I randomly carved out 10% and called it the dev (development) set. In the dev set, I select features and run 5-fold cross validation to find the optimal hyperparameters for each ML algorithm. After all these steps are done, I applied the selected features along with optimized ML algorithms to train and build the models using the full training data, then the trained models will be used to predict and be evaluated in the test set.  Is is appropriate to derive the dev set from the training set? Or do the dev, training and test sets have to be mutually exclusive?  Update: Suggested link  discussed a completely different matter, thus my original question is not a duplicate.

Suppose I trained several models on training set, choose best one using cross validation set and measured performance on test set. So now I have one final best model. Should I retrain it on my all available data or ship solution trained only on training set? If latter, then why?  UPDATE: As @P.Windridge noted, shipping a retrained model basically means shipping a model without validation. But we can report test set performance and after that retrain the model on complete data righteously expecting the performance to be better - because we use our best model plus more data. What problems may arise from such methodology?


I'm confused. I would expect that the first print statement in the function would print 6 and not 5. Because a++ + c++ = (1+1) + (3+1) = (2+4 = 6). #include <iostream> #include <string>  int main() {     int a = 1;     int b = 2;     std::cout << "intitialisation b:"<< b << std::endl;     int c = 3;     {         auto b = ++a + c++;         std::cout << "increment b in function:" << b << std::endl;         auto e = b;         c += ++b;         std::cout << "increment b in function:" << b << std::endl;     }     std::cout << "increment b out function:" << b << std::endl;     int* p = &a;     int* q = &b;     std::cout <<"value pointer:" << *q << std::endl;     ++(*q);     std::cout <<"value pointer:" << *q << std::endl;     *p += a++ + (*p)++; }   intitialisation b:2 increment b in function:5 increment b in function:6 increment b out function:2 value pointer:2 value pointer:3  Nadine

This question attempts to collect the few pearls among the dozens of bad C++ books that are published every year. Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a well-written C++ book. It is way too big and complex for doing this. In fact, it is so big and complex, that there are very many very bad C++ books out there. And we are not talking about bad style, but things like sporting glaringly obvious factual errors and promoting abysmally bad programming styles. Please edit the accepted answer to provide quality books and an approximate skill level — preferably after discussing your addition in . (The regulars might mercilessly undo your work if they disagree with a recommendation.) Add a short blurb/description about each book that you have personally read/benefited from. Feel free to debate quality, headings, etc. Books that meet the criteria will be added to the list.  Books that have reviews by the Association of C and C++ Users (ACCU) have links to the review. *Note: FAQs and other resources can be found in the  and under .


So, what I want to do is a module which can automatically look for some things, but for that I need to take outputs from NMAP, specifically the Software Version. I have only written this, I just want to know how could i make this or if it is possible   def check(): while True:     cmd = raw_input("smb(check) > ")   This is an actual scan of NMAP  PORT      STATE    SERVICE  VERSION 21/tcp    open     ftp      ProFTPD 1.3.5b  What i want to do is to set that ProFTPD 1.3.5b as an object

How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?


"Hediger acquired a drone after losing half of her harvest in one year to weeds. She estimates that identifying problems faster with timely crop data and using less weed killer will save her tens of thousands of dollars in future years. Considerably more than the $7,000 she paid for the drone and any potential costs associated with reviewing images."   In order for the bolded section to be grammatically correct, do I need to use a semicolon (;) or an em dash (-)? I would also appreciate it if you could explain the reason why as well.

Help! I've read everything there is on Google re: semicolon and dash use and, whilst I understand all this, I still struggle deciding when to use a semicolon over a dash to join two independent clauses. I'm an avid endasher (from UK, so endash used more than emdash), and due to their increasing prevalence in newspapers etc, I think I'm a little desensitised to them. Consider the following:  Sorry I didn't get round to helping; it's been a difficult week Sorry I didn't get round to helping - it's been a difficult week I couldn't go to work; I was feeling too sick I couldn't go to work - I was feeling too sick I ate all the food; I was starving I ate all the food - I was starving That's not borrowing; that's stealing That's not borrowing - that's stealing  Now, I feel I say all of these aloud with some sort of emphasis, so I naturally hover over the emdash. So my question is... How do I decide whether my joining clause is dramatic enough to warrant a dash? I understand dashes are more frequent in informal writing (and, if I'm being honest, I'd find myself 'stuffy' using them in emails etc) but, regardless, I'd like to at least feel I know when the semicolon is more appropriate, even if I choose not to use it! Can anyone help? Thanks in advance!


We always told to keep off the electronic devices from water with no explicit reasons. Or remedies to fix the thing when accidents happened.  So, what is the physical reasons behind that submerged electronic or electrial devices get damaged?  For example speaker, motor(high-voltage). Smart phone, headphone(low voltage). Is the effect same?  Generally, is it because extremely low resistivity of water allows abnormal high current flow instead of designed current and eventually "burns" the electronic components or wires. Then there's an open circuit which disable some parts of the circuit or the whole circuit.  Apart from the problems I mentioned ,is there any chance water directly change the physical behavior of some components? If it is the cause how?  Is only my pure guess. Please point out my mistakes if they exist.

Everybody has had the time where water gets all over their electronics, and the whole thing gets ruined, like cell phones.  At that low of a voltage (3-5 volts), I don't understand why it is such a short-term harm (long term makes sense - corrosion, etc.)  If an LED was in parallel with water, maybe a bit more current would be drawn, but it doesn't seem to be enough at all to short out the system, and the LED would still shine.  So what is it that permanently damages some electronics and what is the cause?


I am trying to set up JQuery Scrollify on my website to get a smooth scroll from one section to the others but cannot make it work! I tried different ways and think I might just be missing something? I think I might not be implementing the script correctly or not giving the sections good class name..Or maybe because I am using Bootstrap??  Need help here!! Thank you so much!  Here is my HTML:  <!DOCTYPE html>       <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1">         <title>...</title>         <link href="css/magicledger.css" rel="stylesheet" type="text/css">         <link href="css/normalize.css" rel="stylesheet" type="text/css">         <link href="css/bootstrap.min.css" rel="stylesheet">

...

...

...

...

...

...

...

...

    and my javascript extrernal sheet:  jQuery(document).ready(function($) {  $.scrollify({         section : ".section-class-name",         sectionName : "section-name",         easing: "easeOutExpo",         scrollSpeed: 1100,         offset : 0,         scrollbars: true,         standardScrollElements: "",         setHeights: true,         before:function() {},         after:function() {},         afterResize:function() {},         afterRender:function() {}     });

There are a few ways to include jQuery and jQuery UI and I'm wondering what people are using?   Google JSAPI jQuery's site your own site/server another CDN   I have recently been using Google JSAPI, but have found that it takes a long time to setup an SSL connection or even only to resolve google.com. I have been using the following for Google:  <script src="https://www.google.com/jsapi"></script> <script> google.load('jquery', '1.3.1'); </script>   I like the idea of using Google so it's cached when visiting other sites and to save bandwidth from our server, but if it keeps being the slow portion of the site, I may change the include.  What do you use? Have you had any issues?  Edit: Just visited jQuery's site and they use the following method:  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>   Edit2: Here's how I've been including jQuery without any problems for the last year:  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>   The difference is the removal of http:. By removing this, you don't need to worry about switching between http and https.


My Mac hard drives become inaccessible, and I don’t have any data backup available at present. What should I do now to recover my deleted data?

My hard drive died in my macbook and it no longer will start up. It will not mount in an external enclosure but disk utility is still reading that the hard drive is there, and I tried to repair disk and I am getting this error: (Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.) So my question is how do I backup my files if the hard drive won't mount? The only way that I have been able to see the hard drive is through disk utility. I just want to be clear that I am using mac os x snow leapard.


If $x$ and $y$ are positive real numbers, show that $x^y + y^x ≥  1$.  I think it is trivial that the inequality holds when $x ≥ 1$ or $y ≥ 1$. I'm struggling to prove the inequality when $x < 1$ and $y < 1$.

Find the minimum value for $x^x$ for $x$ a positive real number If $x$ and $y$ are positive real numbers, show that $y^x + x^y > 1$


I have a String with some value. I want to iterate over all classes in a package calling a specific method, and if the value returned by the method is equals the value in my String, create an object of that class.  I want do this in a dynamic way, so if I add a class in this package, it will automatically be in the iteration.  Is possible do this? If not, there is a way to do what I want?    I was expecting something like.  for(Class clazz: SomeClass.listClasses("org.package")){      //code here }

Is it possible to find all classes or interfaces in a given package? (Quickly looking at e.g. , it would seem like no.)


I've received a CSV file exported from an unknown application containing polygon coordinates in the following format:  Title | Latitude 1 | Longitude 1 | Latitude 2 | Longitude 2 | ... | Latitude 50 | Longitude 50  How can I generate polygons from this data in Mapinfo Professional (12.0)?

I have a huge number of points(co-ordinates), from which I am required to draw a polygon in Mapinfo.  This required polygon is a square of 200m size. All I have now is the left side lower end of the polygon.   Is there anyway that I can draw a square of 200m from this point automatically using MapInfo MBX files?


I have two hashMaps :  private HashMap<String, HashMap<String, Integer>> attributesCountPerCategory;   and  private HashMap<String, Integer> attributesCount;   I also have the method:  public void increaseAttributes(String attr, String category){     HashMap<String, Integer> attributes = this.attributesCountPerCategory.get(category);     if (attributes == null) {         this.attributesCountPerCategory.put(category, new HashMap<String, Integer>());         attributes = this.attributesCountPerCategory.get(category);     }      Integer c = attributes.get(attr);     if(c == null){         attributes.put(attr, 0);         c = attributes.get(attr);     }     attributes.put(attr,c++);      Integer c2 = this.attributesCount.get(attr);     if(c2 == null){         this.attributesCount.put(attr,0);         c2 = this.attributesCount.get(attr);                 }     this.attributesCount.put(attr,c2++);         }   So when I am calling this method a NullPointerException is thrown even though I am checking for null values in object references. The exception is thrown in the below line:   HashMap<String, Integer> attributes = this.attributesCountPerCategory.get(category);   What could be the problem?

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


Quoting " Let $\phi : Z \rightarrow Z$ be given by $\phi(n) = 7n$. [...] Find the image of $\phi$."   My understanding (revised):  I claim that the only possible image-elements of $\phi$ are the multiples of 7 in z denoted 7Z.   To prove this I have to show that Im$(\phi) \subset 7 \Bbb Z$ and that $ 7 \Bbb Z \subset $ Im$(\phi)$.  Proving Im$(\phi) \subset 7 \Bbb Z$ :      $\forall y \in $ Im$(\phi)$ such that $  y =\phi(x)$ where $x \in 7 \Bbb Z$. It follows that $y \in 7 \Bbb Z$. Therefore, Im$(\phi) \subset 7 \Bbb Z$   Proving $ 7 \Bbb Z \subset $ Im$(\phi)$:   $\forall y \in  7\Bbb Z$ such that $  y =7x$ where $x \in \phi(x)$. It follows that $y \in \phi(x)$. Therefore, $ 7 \Bbb Z \subset $ Im$(\phi)$.   Any input to my understanding is much appreciated.

Quoting " Let $\phi : \Bbb Z \rightarrow \Bbb Z$ be given by $\phi(n) = 7n$. Prove that $\phi$ is a group homomorphism. Find the kernel, and the image of $\phi$."   My understanding:  Part 1:   Given $n,m \in \Bbb Z$, let's check that $\phi(n+m) =\phi(n)+\phi(m)$  $$\phi(n+m) = 7(n+m) = 7n + 7m = \phi(n)+\phi(m)$$  Therefore as the group operation in $\phi$ is preserved, $\phi$ is a group homomorphism.  Part 2 (revised):   $\phi$ is one-to-one as:  $\space \space \phi (n) = \phi(m) \Rightarrow 7n =7m \Rightarrow n=m  $. We also know that $\phi(e)=e$ by the property of homomorphism. Therefore, no other object than $0$ in the domain can map to $0$ in the codomain. It follows that: $$\ker(\phi)=\{ x \in \Bbb Z : \phi(x)=e\}=\{e\}$$   Part 3 (revised):  I claim that the only possible image-elements of $\phi$ are the multiples of $7$ in $\mathbb Z$ denoted $7\mathbb Z$.   To prove this I have to show that Im$(\phi) \subset 7 \Bbb Z$ and that $ 7 \Bbb Z \subset $ Im$(\phi)$.  Proving Im$(\phi) \subset 7 \Bbb Z$ :      $\forall y \in $ Im$(\phi)$ such that $  y =\phi(x)$ where $x \in 7 \Bbb Z$. It follows that $y \in 7 \Bbb Z$, therefore Im$(\phi) \subset 7 \Bbb Z$   Proving $ 7 \Bbb Z \subset $ Im$(\phi)$:   $\forall y \in  7\Bbb Z$ such that $  y =7x$ where $x \in \phi(x)$. It follows that $y \in \phi(x)$, therefore $ 7 \Bbb Z \subset $ Im$(\phi)$.   Any input to my understanding is much appreciated.


Is there a QGIS tool that does the function of   MY NEED - I have about 15,000 points. I need them clustered in batches of about 700 and polygons created for each batch. There will be a central node that it needs to radiate from.  This was asked back in 2013 in  but there were no replies.  This should look like:    There is almost a PostGIS (and other) solution in the following but this is now ~4y old   I also had a look at the following but can't find anything that does what I need.   I NEED a result like this. Is this essentially the  module where the  has several issues?

I'm attempting to create n sub-regions from a polygon based on a cluster analysis of a bunch of overlapping raster layers (physical layers, eg: depth, currents, waves).  Currently, I can create a regular grid across the polygon, then extract physical attributes from the physical raster layers (eg: Gridspot or equivalent tool) then, run a cluster analysis restricted to n number of clusters (in R or other stats package).   Then, I can identify each cluster-group, and plot them back in GIS (QGIS or ArcMap). I envisage however, that some cluster-groups will be dispersed (spatial outliers and not meaningful), whereas some will be clumped (worthy of being a sub-region).   I could then manually draw around representative clumps to create n sub-regions.  Is there a tool like ArcMap 10.1  that can be run in QGIS? I'm only running 10.0.  Are there suggestions of a better way to do cluster analysis of multiple raster layers, to create n sub-regions (bio-regions)?


I am using the iOS Stack Overflow app. I often use the app on the go to view answers to the question I have posted. I also use it to post new questions whenever something pops up in my mind when I am on the go.  And as a curious Stack Overflow user, I like to monitor the progress of my questions. One way to do that is see the number of views for my questions. But unfortunately, I don't see this stat on the Stack Overflow iOS app.  I therefore request you to update the app to show the number of views for a question when you visit that question on the app.   I would also like to take this opportunity to ask you to make the app full screen for iPhone X onwards! Utilizing the whole viewport will definitely give a better user experience.

This is basically the same as  for the Android app, except I am making the request for the iOS app.  When viewing a question in the iOS app, I'd like to see the total number of views for the question.


Let $A= a(i,j)$ and $B= b(i,j)$ be ($n\times n$) matrices that are positive definite such that $a(i,j) < b(i,j)$.  Let $C= c(i,j)= b(i,j) - a(i,j)$, then $C$ is also positive definite. Why or why not?

Let $A= a(i,j)$ and $B= b(i,j)$ be ($n\times n$) matrices that are positive definite such that $a(i,j) < b(i,j)$ .Let $C= c(i,j)= a(i,j) - b(i,j)$, then $C$ is also positive definite. Why or why not?  what i know is $x^T(C)x= x^T (A-B) x = x^T(A)x - x^T(B)x$. Now both terms on right-hand side are greater than $0$ as $A$ and $B$ are positive definite. Also  $a(i,j) < b(i,j)$. But in such case the sign of $x^T(C)x$ being positive or negative will also depend on the value of elements of vector $x$. So, we can't assure that $x^T(C)x < 0$ always or that $C$ is not positive definite.  Am i right about this?


This question is related with the topic:   I have understood the formula used to determine $(x,y)$ such that $x^2+y^2=M$ with $M$ composite. But what if $M$ is a large prime such as $M=1000000241$ do I have to do only bruteforcing? Are there other methods?  EDIT:  I know that $M$ must be a prime of the form $4k+1$ but how to find $(x,y)$?  Thanks

The web is littered with any number of pages () giving an existence and uniqueness proof that a pair of squares can be found summing to primes congruent to 1 mod 4 (and also that there are no such pairs for primes congruent to 3 mod 4).  However, none of the stuff I've read on the topic offers any help with actually efficiently finding (ie other than a straight search up to sqrt(p)) the concrete values of such squares.  What's the best way to actually find them ?


After configuring my Galaxy S4 (Android 4.4.2) phone to use a proxy server for debugging an app, I noticed that other apps on my device were making some suspicious HTTP calls.  I would like to track down what app is doing this.  Unfortunately, the request itself didn't have any clues... it only contained a generic User-Agent header:  User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.2; SPH-L720 Build/KOT49H)   The response was also generic, and not related to anything I have knowingly installed.  Is there a way to log apps making HTTP requests on my Android device?

Is it possible to listen/monitor an app's network activities?  I have this one app, and I couldn't figure out where it gets its images. I tried to google an app to listen to other apps connections, but I didn't find any. I'm looking for similar functionality as Google Chrome's network tab from developer menu.  I have rooted Nexus 4 with 4.2.2.


Nothing insidious going on but I've got a bunch of domains that we've bought for a service and I don't want to buy an SSL certificate for them all (there's about 11).  As an example, we've got:  example.com thisisexample.com ourexample.com theexample.com   I have an SSL certificate for example.com and it is the main domain we're going to use. To protect our IP we've bought up a lot of similar domains and we're redirecting them all to example.com.  I've setup some redirects already and they're working fine on HTTP/80, both www and non-www.  However, accessing any of the domains on HTTPS/443 shows the privacy error.  Is there any way around this without having to buy lots of certificates? Can I not redirect https for one domain to another and allow that to terminate SSL?  EDIT:  My question is relating to Nginx, not Apache2.

We have an apache server which hosts multiple domains from, which  some have https enabled and some do not.  Now the problem is that if I access  I will come to the content of .  I would like to  forward the user from  to  on all domains whithout https. I have tried to create a redirect rule in virtualhost *:443 but this creates the following error:  Server should be SSL-aware but has no certificate configured  The problem is that I cant change "Listen 443" to "Listen 443 http" as this would break my hosts with ssl enabled.  Is there a way I could have a redirect without a ssl certificate ?  Or if not possible  can you propose an alternative which would ensure that   does not show the content of   .  My ports.conf   NameVirtualHost *:80 Listen 80 NameVirtualHost *:443 Listen 443   mi site condfig:  <VirtualHost *:80>  DocumentRoot /path/to/dr  ServerName  exampleWithoutHttps.com  ServerAlias www.exampleWithoutHttps.com </VirtualHost>  <VirtualHost *:443>  ServerName  exampleWithoutHttps.com  ServerAlias www.exampleWithoutHttps.com  Redirect permanent /   http://www.exampleWithoutHttps.com/ </VirtualHost>


The program I'm making needs to output true or false when using method backwards(), indicating if the string is backwards or not.. But it keeps displaying false when it's supposed to be true...   public class StringImproved {    private String word;  public StringImproved(String word) {   this.word = word;  } public String getWord() {   return(this.word);  } public void setWord(String word) {   this.word = word;  } public int size()  {   return(this.word.length());   }  public boolean backwards(String word) {    String backwards = "";    for(int i = getWord().length() - 1; i >= 0; i--)    {      backwards += getWord().charAt(i);     }    if(backwards == word)    {    return true;     }    else return false;     } }   public class test {    public static void main(String [] args)  {  StringImproved si=new StringImproved("lag");  System.out.println(si.backwards("gal"));     }   }

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


PhpStorm tells me that FILTER_SANITIZE_MAGIC_QUOTES is deprecated. What filter should be used in its stead? I'm using it to sanitise data before it is used to create MariaDB queries.

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?


I have a simple html:  <html> <body> <head> <meta charset="utf-8"> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='expires' content='0'> <meta http-equiv='pragma' content='no-cache'> <script src="test.js"></script> </body> </html>   In test.js I changed a Javascript function, but my browser is caching this file. How to disable cache for script src?

I have noticed that some browsers (in particular, Firefox and ) are very zealous in using cached copies of .css and .js files, even between browser sessions. This leads to a problem when you update one of these files, but the user's browser keeps on using the cached copy. What is the most elegant way of forcing the user's browser to reload the file when it has changed? Ideally, the solution would not force the browser to reload the file on every visit to the page.  I have found  and  suggestion to be useful. It turns out there is a term for this: auto-versioning. I have posted a new answer below which is a combination of my original solution and John's suggestion. Another idea that was suggested by SCdF would be to append a bogus query string to the file. (Some Python code, to automatically use the timestamp as a bogus query string, was .) However, there is some discussion as to whether or not the browser would cache a file with a query string. (Remember, we want the browser to cache the file and use it on future visits. We only want it to fetch the file again when it has changed.)


In my minecraft server/realm I have done this command block that allows one person to sleep and I did the command and that command block disappeared. Now every time a person sleeps a chat message comes up in Spanish:    I've tried the command /gamerule commandblockoutput false but it didn't work.   How can I fix it?

I've placed a command block making it day all the time. I want to turn it off, but I've lost it. What's the quickest way to find it?


I noticed tree-like patterns on inner surfaces of home appliances plastic bodies. For example, on the lid of air conditioner indoor unit, inside of humidifier, at the bottom of washing machine powder drawer. The shape of the patterns reminds of , but there's no source of high voltage inside those machines and no obvious reason of forming a high electric charge on the surface (and I've never been hit by a spark from them).  The following pictures demonstrate some of the patterns I found. The "branches" are near 1 mm wide. Contrast was increased a little.   The patterns can be easily washed away with soap and water, they are probably formed of dust. Air indoors is moderately humid in summer and very dry in winter, if it's important.  What is the reason of those patterns and what do they consist of?  EDIT.   Similar question  pointed by  shows the same dust patterns. The answer marked as accepted suggests that dust attaches to irregularities on plastic surface around marks from  process. In my pictures the surface is free from such marks, but it can have salt deposit from water drops. The  on that question is very elaborate.  of charged dust particles on differently charged surface is an interesting suggestion, that is the most probable in my opinion. Similar question  shows the same dust patterns. No answer is accepted. The highest rated answer describes deposition of statically charged dust particles onto plastic surface (like the previous one).  on Biology StackExchange. Comments state that dry plastic surface is unlikely to support life, but if it's a living thing, it's a fungal colony. Answer suggests that pattern can be a crystallization structure when liquids dry up. It can be plausible in my case (all mentioned machines deal with water that is splattered on plastic surfaces and dries up from time to time), but is not an explanation with electronics mentioned in other questions.

I took apart my cooling platform Something like this :  And I found something like this inside :       I wonder why around the hollows are the "canyon like" structures.  PS: I also drop this platform on the floor, maybe this could be a reason ?   EDIT :  Everybody seems (except Brandon Enright answer) to ignore the word "dust" in this question. Those structures are not in the plastic itself. It is dust ON the plastic.  Proof :     Completely wiped out with my finger :


Here's what my current partition table looks like:   Now, I'd like to increase the size of my Ubuntu partition (/dev/sda8) to, say, 20 GB. But it seems to me there's no way to do that other than deleting everything and starting anew, which makes me scared (don't want to lose all the settings and good stuff).  When I tried to do this via the GParted editor in boot mode, it warned that moving partitions will mess up the bootloader and operating systems and what not, so I didn't do it.  I'm a total noob, so am requesting someone to help me achieve this. Thanks!

Previously, I have installed Windows 7 on my 320 GB laptop with three partitions 173, 84 and 63 GB each. The 63 GB partition was where the Windows was installed. The rest were for file containers.  Now I changed my OS to Ubuntu 12.04 LTS. I installed Ubuntu by replacing the entire Windows 7 on the 63 GB partition. The rest of the partitions remain as an NTFS Windows partition and I can still access them both (the 173 and 84 GB partitions).  Now I want to change the two partitions of Windows into an Ubuntu format partitions plus most importantly, I want to extend the 63 GB partition to more than a 100 GB because at the moment I am running out of disk space. Whenever I try to install any application, especially using wine, it always complains for a shortage of disk space.  How do I do the extending activity before I entirely format my laptop again and lose all the important files on my partitions?


I am tryig to use graphicspath to specify a directory where i keep all of my images. Here is a MWE  \documentclass[journal]{IEEEtran} \hyphenation{op-tical net-works semi-conduc-tor} \usepackage{placeins} \usepackage{amsmath} \usepackage{graphicx} \graphicspath{{C:/Users/Me/OneDrive - UofO/LaTeX/IEEEtran/Images/}}   \begin{document}   A schematic is illustrated in figure \ref{Schematic}c. \FloatBarrier \begin{figure} \includegraphics[width=\linewidth]{Schematic.png} \caption{Schematic} \label{Schematic} \end{figure} \FloatBarrier \end{document}   However I get an error, '! Package pdftex.def Error: File `Schematic.png' not found.'   I have seen several other threads on this topic, I have tried removing the / after Images in graphicspath, I have quadruple checked that the directory is correct, I have made sure that I am compiling with pdfLaTex. But still nothing seems to work here. Any suggestions on what's going wrong?

I'm going crazy...  I have a file I want to include which path is C:\Users\Matthieu\Documents\Folder withOneSpace\myFile.tex. (As you can see with the \, I'm on windows actually)  I tried the following but none works:  \input{C:/Users/Matthieu/Documents/Folder withOneSpace/myFile} \input{C:/Users/Matthieu/Documents/Folder\ withOneSpace/myFile} \input{C:/Users/Matthieu/Documents/Folder withOneSpace/myFile.tex} \input{C:/Users/Matthieu/Documents/Folder\ withOneSpace/myFile.tex}   I also tried to put the file out of the folder with a space and it works (no surprise):  \input{C:/Users/Matthieu/Documents/myFile} --> Works   All I found is to put a \ before the space but it doesn't work at all. --> Please help ! :)


When I Google the units for $E=mc^2$ it says m is mass in kg speed of light is in m/s and energy is in joules. Why does there not need to be some sort of constant? Why does the total energy in joules relate to the speed of light in meters per second. Isn't the second based of how long the earth takes to spin round. If a second was slightly longer would the joule be slightly smaller? Sorry if this is a stupid question.

Why is it that many of the most important physical equations don't have ugly numbers (i.e., "arbitrary" irrational factors) to line up both sides?   Why can so many equations be expressed so neatly with small natural numbers while recycling a relatively small set of physical and mathematical constants?  For example, why is mass–energy equivalence describable by the equation $E = mc^2$ and not something like $E \approx 27.642 \times mc^2$?  Why is time dilation describable by something as neat as $t' = \sqrt{\frac{t}{1 - \frac{v^2}{c^2}}}$ and not something ugly like $t' \approx 672.097 \times 10^{-4} \times \sqrt{\frac{t}{1 - \frac{v^2}{c^2}}}$.  ... and so forth.    I'm not well educated on matters of physics and so I feel a bit sheepish asking this.   Likewise I'm not sure if this is a more philosophical question or one that permits a concrete answer ... or perhaps even the premise of the question itself is flawed ... so I would gratefully consider anything that sheds light on the nature of the question itself as an answer.    EDIT: I just wished to give a little more context as to where I was coming from with this question based on some of the responses:  @Jerry Schirmer comments:      You do have an ugly factor of $2.997458 \times 10^8 m/s$ in front of everything. You just hide the ugliness by calling this number c.   These are not the types of "ugly constants" I'm talking about in that this number is the speed of light. It is not just some constant needed to balance two side of an equation.  @Carl Witthoft answers:      It's all in how you define the units ...   Of course this is true, we could in theory hide all sorts of ugly constants by using different units on the right and the left. But as in the case of $E=mc^2$, I am talking about equations where the units on the left are consistent with the units on the right, irrespective of the units used. As I mentioned on a comment there:     $E=mc^2$  could be defined using units like $m$ in imperial stones ($\textsf{S}$), $c$ in cubits/fortnight ($\textsf{CF}^{−1}$) and $E$ in ... umm ... $\textsf{SC}^2\textsf{F}^{−2}$ ... so long as the units are in the same system, we still don't need a fudge factor.   When the units are consistent in this manner, there's no room for hiding fudge constants.


I don't really use brown sugar that often and I would like to know, if I am baking a recipe that calls for a cup of brown sugar, could I use white sugar instead? If not, why? Do they not "bake" the same?   Thank you!

I want to bake a cake but I don't have light brown sugar. Can I replace it with white sugar?


Ho to find the following integral $$\int_{-\infty}^{\infty}\frac{1}{x^{12} + 1} dx $$using parts by  substitution, partial fractions, etc. but not Cauchy's residue theorem?

I've been looking at  $$\int\limits_0^\infty  {\frac{{{x^n}}}{{1 + {x^m}}}dx }$$  It seems that it always evaluates in terms of $\sin X$ and $\pi$, where $X$ is to be determined. For example:  $$\displaystyle \int\limits_0^\infty  {\frac{{{x^1}}}{{1 + {x^3}}}dx = } \frac{\pi }{3}\frac{1}{{\sin \frac{\pi }{3}}} = \frac{{2\pi }}{{3\sqrt 3 }}$$  $$\int\limits_0^\infty  {\frac{{{x^1}}}{{1 + {x^4}}}dx = } \frac{\pi }{4}$$  $$\int\limits_0^\infty  {\frac{{{x^2}}}{{1 + {x^5}}}dx = } \frac{\pi }{5}\frac{1}{{\sin \frac{{2\pi }}{5}}}$$  So I guess there must be a closed form - the use of $\Gamma(x)\Gamma(1-x)$ first comess to my mind because of the $\dfrac{{\pi x}}{{\sin \pi x}}$ appearing. Note that the arguments are always the ratio of the exponents, like $\dfrac{1}{4}$, $\dfrac{1}{3}$ and $\dfrac{2}{5}$. Is there any way of finding it? I'll work on it and update with any ideas.    UPDATE:  The integral reduces to finding   $$\int\limits_{ - \infty }^\infty  {\frac{{{e^{a t}}}}{{{e^t} + 1}}dt} $$  With $a =\dfrac{n+1}{m}$ which converges only if   $$0 < a < 1$$  Using series I find the solution is     $$\sum\limits_{k =  - \infty }^\infty  {\frac{{{{\left( { - 1} \right)}^k}}}{{a + k}}} $$


When I switch to a branch, I can see modifications done in other branch ...  Sample : - I'm on master - I switch to branc A - I do some modifications - status show me modified files - I switch to master - status is always showing me the same modifications  I have already used branches on other project and other computer without this problem : when I switched to another branch, the modifications were not more visibles ...  Any idea ?  Thanks,  Xavier

I am working on a git repository with a master branch and another topic branch. I have switched to topic branch and modified a file. Now, if I switched to master branch that same file is shown as modified.   For example:  git status in git-build branch:  # On branch git-build # Changes to be committed: #   (use "git reset HEAD <file>..." to unstage) # #       modified:   cvsup_current #   Switch to master branch  [root@redbull builder_scripts (git-build)]# git co master M       builder_scripts/cvsup_current Switched to branch "master"   git status in master branch  [root@redbull builder_scripts (master)]# git status # On branch master # Changes to be committed: #   (use "git reset HEAD <file>..." to unstage) # #       modified:   cvsup_current #   Why is that the file is shown as modified in master branch even though it was modified in git-build branch?   My understanding was that the branches are independent of each other and when I change from one branch to another the changes do not "spill over" from one branch to another. So I am obviously missing some thing here.   Anyone got a clue stick?


I am confused by the explanations of time dilation and gravity vs. acceleration. The consensus (and apparently experiments) is that time dilation in a gravitational field (not free-falling) is "as if" one were accelerating. Examples given for sending light signal each way in a gravitational gradient, one sees blue shift the other red shift just as if accelerating in space due to velocity transformation. But is there a paradox? If actually accelerating, the velocity will increase and so will the time dilation relative to origin. If in a gravity field, the effect on clock time will be a constant difference relative to free-fall (e.g., orbit). Satelite clocks are apparently corrected for both velocity and gravity density which should be equivalent to acceleration. If a satelite were moving above escape velocity but held to the earth on a tether, would its time dilation only be a difference from the velocity, or would the force of the tether imply higher gravity density? Any thoughts?

Please will someone explain what time dilation really is and how it occurs? There are lots of questions and answers going into how to calculate time dilation, but none that give an intuitive feel for how it happens.


I'm a new programmer and I'm having a lot of trouble understanding for loops and while loops. In what situations would I know to use a for loop and in what situations would I know to use a  while loop?   Also, could you explain to me what these 2 codes mean? I have a a  lot of confusion.   1 function:   def every_nth_character(s, n):       """ (str, int) -> str        Precondition: n > 0        Return a string that contains every nth character from s, starting at index 0.        >>> every_nth_character('Computer Science', 3)       'CpeSee'       """        result = ''        i = 0        while i < len(s):              result = result + s[i]             i = i + n        return result   ****What does s[i] mean?****  2nd function:    def find_letter_n_times(s, letter, n):       """ (str, str, int) -> str        Precondition: letter occurs at least n times in s        Return the smallest substring of s starting from index 0 that contains       n occurrences of letter.        >>> find_letter_n_times('Computer Science', 'e', 2)       'Computer Scie'       """       i = 0        count = 0       while count < n:             if s[i] == letter:                    count = count + 1             i = i + 1        return s[:i]   what does s[i] and s[:i] mean??

I need a good explanation (references are a plus) on Python's slice notation.   To me, this notation needs a bit of picking up.   It looks extremely powerful, but I haven't quite got my head around it.


My computer is pretty fast, but I feel it may be getting slowed down by putting things in swap which would do better in RAM. I have 16 GB of ram, and even in conditions where only around 3 GB is used, the swap is already up around 500MB. I don't have the greatest understanding up how windows deals with memory and such (so correct me if I am wrong) but I think that performance would increase if that 500 MB of swap was put in RAM instead.  So my general question is how would I get windows to (force if need be) to favour RAM over its swap when putting stuff in memory.  Thanks

Is there a way (application) to control RAM / swap usage policy at application level.  I have some applications that I use all the time and I want them to stay in RAM all the time and there are also application that I use quite seldom and they might be thrown to swap at demand. I know that default configured windows should give me best performance but I want to check whether I can get more :).  I use windows 7.


Could you tell me if there is any difference in meaning between what happens when/if... and what will happen when/if... For example:  What happens if you lose your job? Do you have a plan? What will happen if you lose your job? Do you have a plan?

When I am using the future tense, why do "while"  and "when" clauses have to be in the present tense?     For instance,       "While I am eating you will be speaking on the phone"   and    "I will be waiting when your plane arrives"   Both sentences are grammatically correct.     But,  doesn't it make more sense to say   "While I will be eating you will be speaking on the phone"  and      "I will be waiting when your plane will arrive."  ?


I am learning how multithreading is supported by Spring. I found that Spring docs say that JdbcTemplate is  once configured. People suggest to use one instance of JdbcTemplate for the whole app as it is thread-safe (meaning there is no need to create a new instance for each class).  But when i look at the JdbcTemplate code i do not see any synchronized methods, locks or volatile variables. Also it contains a lot of instance variables. My question is how the JdbcTemplate can be thread-safe in this case?

Is it safe to fork off a Thread to execute an insert using a JdbcTemplate in Swing.  It's a logging event and as much as possible I don't want it to affect perceived performance.


Can you tell me about 2 sentences below. I don't know which one is make sense or both of them are right?   I went window-shopping. I was window-shopping.

I'm wondering whether or not the verb form that follows a catenative verb has the grammatical function of a noun or of a verb, and whether or not it depends on the first catenative verb.  "I like to run" "I like running"  the -ing and the to infinitive can easily be switched in this sentence, and it seems to be implying "I like [the act of[running]]", so both the infinitive and the gerund are nouns.  "I like to run marathons"/"I like running marathons"   These seem like they might still be nouns but need "verb powers" to take the object, and then these sentences really turn into "I like [the act of [running marathons]]"/ "I like [to be in the state of [running marathons]]".  Is this true for both the -ing (and so it would be a gerund) and the to-infinitive? Are they, sort of, initially verbs so that they can take the object, and then the verb + object becomes a noun phrase?  If this is true, I'm also wondering if the same rules apply for a catenative verb such as "start".  "I started to run in the mornings" "I started running marathons in 2008"  "start" is a catenative verb that isn't a cognitive/emotion verb, and specifically suggests action. So what is the grammatical function of the to-infinitive and -ing verb forms? are they verbs? are they nouns? It just seems incorrect to say that their grammatical function is a noun, but everything I've seen on the internet is pretty vague. I've also seen that to-infinitives are never verbs, but only from one source and it just doesn't seem right to me.  So any ideas on the true grammatical function of the -ing and the to-infinitive after a catenative verb? And is it universal across catenative verbs, or does it depend on the verb category?


This problem is from a practice exam I was working on.     What is the cardinality of the quotient $\mathbb{Z}[x]/(x^2-3,2x+4)$ ?   Thoughts. If I find a ring that is easier to handle then this then I can go from there. So I think this is isomorphic to $\mathbb{Z}_2[x]/(x^2-3,x+2)$. And then I am stuck.  Am I correct so far? What should I be looking to do from here?  Thanks for your time and your answers.

I had to calculate the number of elements of this quotient ring:   $$R = \mathbb{Z}[X]/(X^2-3, 2X+4).$$   This is what I've got by myself and by using an internet source:  Writing the ring $R = \mathbb{Z}[X]/(X^2−3, 2X+4)$ as $\mathbb{Z}[X]/I$, we note that $I $ contains $2(X^2−3)−(X−2)(2X+4) = 2$. We then note that the generator $2X + 4$ is actually superfluous since $2X + 4 = 2(X + 2)$.   Now we can write $R = \mathbb{Z}[X]/(X^2 − 3, 2) = \mathbb{Z}[x]/((X+1)^2, 2)$, because $(X+1)^2=X^2+2X+1=X^2-3+2X+4$. The internet source states now the following:  $$ R \cong (\mathbb{Z}/2\mathbb{Z})[\alpha] \quad \text{with} \quad \alpha = X+1$$ I guess that $\mathbb{Z}/2\mathbb{Z}[\alpha]$ represents the set of dual numbers of the field $\mathbb{Z}/2\mathbb{Z}$. I see that $\alpha^2=0$, but what exactly implies the isomorphism? And does this mean that the quotient ring $R$ contains four elements?  If necessary, you can take at the site I used. (It's about page 5, exercise 4.3a.)    I thank you in advance for your answers.


Think of this as phone support for a user with little experience. How can I tell them, without diagrams or esoteric command-line structures, how to find this info for themselves.  There are several questions on here where people have gone to intricate methods to discover what process is preventing their computer from sleeping. Many of these date back to old Windows versions & none seem to have a simple, comprehensive method. I'm used to macOS, where I can simply open Activity Monitor - which is the Mac equivalent of Task Manager - & add a column, "Preventing sleep" As you can see from this picture, I have a 24-hour surveillance camera running, so the app & as a consequence hidd [hardware interfaces process] jointly are keeping me awake - to be expected.  Is there a simple Windows built-in equivalent? I'm not interested in 3rd party tools unless it's one of those 'everybody should have' tools I simply haven't yet discovered, so this is not a product request, it's a "does this functionality exist in Windows?" request.

After I click 'Hibernate', my laptop does hibernate, but only sometimes. Other times, the screen immediately fades black. But then the power button stays illuminated, and 10 s later (after I clicked 'Hibernate') the screen reappears, with everything before still opened.In both cases, my laptop had the same 3 USB devices plugged.  and  didn't help:  Update on 28 July 2018 Performing the steps in , didn't help. See  for my most updated energy-report.html.


This is my entire script. it is simply to avoid having to type it again and again  cd api rails s -p 3001 -b 0.0.0.0 cd ..   When I am in the directory of the script and run cd api it works just fine. However when I run the script via ./start_server It does not work. Here is the output of ls -al:  mendel@DESKTOP-LIKG5E5:/mnt/c/Projects/chaverim-update$ ls -al total 8 drwxrwxrwx 0 root root  512 Apr 13 12:32 . drwxrwxrwx 0 root root  512 Apr  5 12:40 .. drwxrwxrwx 0 root root  512 Apr 13 12:09 api -rwxrwxrwx 1 root root 1237 Apr  5 12:40 boxfile.yml drwxrwxrwx 0 root root  512 Apr  8 16:54 .bundle drwxrwxrwx 0 root root  512 Apr  8 16:54 client drwxrwxrwx 0 root root  512 Apr 13 12:09 .git -rwxrwxrwx 1 root root   11 Apr  5 12:40 .gitignore -rwxrwxrwx 1 root root 1097 Apr  5 12:40 LICENSE drwxrwxrwx 0 root root  512 Apr  5 12:40 nginx -rwxrwxrwx 1 root root   82 Apr  5 12:40 Procfile -rwxrwxrwx 1 root root   67 Apr  5 12:40 README.md -rwxrwxrwx 1 root root  188 Apr  5 12:40 run_tests -rwxrwxrwx 1 root root   28 Apr  5 12:40 start_client -rwxrwxrwx 1 root root   41 Apr 13 12:52 start_server drwxrwxrwx 0 root root  512 Apr  8 16:54 vendor   As you can see there is a folder called api at the top and the start_server script is set to have execution permissions.

I'm trying to write a small script to change the current directory to my project directory:  #!/bin/bash cd /home/tree/projects/java   I saved this file as proj, added execute permission with chmod, and copied it to /usr/bin. When I call it by: proj, it does nothing. What am I doing wrong?


Hi I am getting this error:  Writing record number:      60479System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must   be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.   I have tried this :  try {      DateTime dt = Convert.ToDateTime(fireBirdReader["DUEDATE"]);      cmd.Parameters.AddWithValue("@DUEDATE", fireBirdReader["DUEDATE"]); } catch {      cmd.Parameters.AddWithValue("@DUEDATE", DateTime.Now); }   Also I have tries this:  DateTime temp; if(DateTime.TryParse(startDateTextBox.Text, out temp)) { cmd.Parameters.AddWithValue("@DUEDATE", temp); } else { cmd.Parameters.AddWithValue("@DUEDATE", DateTime.Now); }   But none of them working. I am using c# and console application.  Why you are marking as duplicate that answer is not working in my case. Can you please test it yourself. Do not try to over smart before try. I can also search google and stackoverflow.

I've been using this piece of code I've written and it's working in this most unclear manner. I wish to insert a row into the database which includes two columns of DateTime:  myrow.ApprovalDate = DateTime.Now myrow.ProposedDate = DateTime.Now   And yet, when I update the database I receive this error:     SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.    I've even tried copying an inserted value from the database and hard code it into the object being updated:  // I copied this value from the DB myrow.ApprovalDate =  Convert.ToDateTime("2008-12-24 00:00:00.000");   Still same error, the strange part is that the above trick worked for the first insert to the DB but failed from there on. Any ideas what's going on?


I've performed PCA on face images dataset and I'm not sure how can I use the most informative principal components to show the "reduced" image.  The original image is 96*96 pixels (96*96 = 9216) and I use a sample of 70 images here (70 rows and 9216 column). We get 70 principal components (min{num of samples, num of features}=70).    How can I re-construct a 96x96 image in order to show the eigenfaces? I want to show my students how the eigenvectors "predict" the real data.  The dataset I'm using .  The code:  install.packages("foreach")  file ='C:\\I\\Love\\Data Science\\face.training.csv' data_all = read.csv(file , stringsAsFactors=F) dim(data_all) #7049   31  # use only 70 first images data = data_all[1:70,] names(data) str(data)  # extract the images data im.train <- data$Image     data$Image = NULL  # each image is a vector of 96*96 pixels (96*96 = 9216). library(foreach) im.train <- foreach(im = im.train, .combine=rbind) %dopar% {   as.integer(unlist(strsplit(im, " "))) }  # im.train is a matrix of pixels 70x9216  # show picture number 2 im <- matrix(data=rev(im.train[2,]), nrow=96, ncol=96) image(1:96, 1:96, im, col=gray((0:255)/255))  # Apply PCA pca <- prcomp(im.train,                  center = TRUE,                  scale. = TRUE) ## using correlation matrix  # There are in general min(n − 1, p) informative principal components in a data set with n observations and p variables. Hence, pca$x is 70x70  # Standard deviation of each component pca$sdev  # A numeric matrix which provides the data for the principal components analysis pca$x     dim(pca$x)   # The print method returns the standard deviation of each of the PCs,  # and their rotation (or loadings), which are the coefficients of the linear combinations of the continuous variables. print(pca)  #The summary method describe the importance of the PCs. summary(pca) #The first row describe again the standard deviation associated with each PC.  #The second row shows the proportion of the variance in the data explained by each component  #while the third row describe the cumulative proportion of explained variance.    # plot method returns a plot of the variances (y-axis) associated with the PCs (x-axis).  # useful to decide how many PCs to retain for further analysis.  plot(pca, type = "l")

I have a big dataset and I want to perform a dimensionality reduction.   Now everywhere I read that I can use PCA for this. However, I still don't seem to get what to do after calculating/performing the PCA. In R this is easily done with the command princomp.  But what to do after calculating the PCA? If I decided I want to use the first $100$ principal components, how do I reduce my dataset exactly?


My draggable elements are created dynamically. every time I add an item, I call draggable() again. They get draggable classes, but don't drag.  When writing draggable to the debug console, it successfully works with non-dynamic elements.  $(window).on('load', function () {     var item = '

';     $field.append(item);     dragItems();  });  function dragItems() {     var $items = $('.item');      $items.draggable();  }   In the inspector, I see that the drag classes are created, but the movement does not occur.

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


I want textbooks about special relativity that demonstrates  the relativistic phenomena  by deep details

I am looking for a textbook that treats the subject of Special Relativity from a geometric point of view, i.e. a textbook that introduces the theory right from the start in terms of 4-vectors and Minkowski tensors, instead of the more traditional "beginners" approach. Would anyone have a recommendation for such a textbook ?  I already have decent knowledge of the physics and maths of both SR and GR ( including vector and tensor calculus ), but would like to take a step back and expand and broaden my intuition of the geometry underlying SR, as described by 4-vectors and tensors. What I do not need is another "and here is the formula for time dilation..." type of text, of which there are thousands out there, but something much more geometric and in-depth.  Thanks in advance.


i get these error  C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x1b): undefined reference to BST<char>::BST()' C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x1eb): undefined reference toBST::insert(char const&)' C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x228): undefined reference to BST<char>::traversePreorder(BSTNode<char>*)' C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x263): undefined reference toBST::search(char const&) const' C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x32b): undefined reference to BST<char>::deleteNode(char const&)' C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x419): undefined reference toBST::leafCount(BSTNode*)' C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x47c): undefined reference to BST<char>::search(char const&) const' C:\Users\SDRav\AppData\Local\Temp\ccCy0RiX.o:driver.cpp:(.text+0x4d5): undefined reference toBST::getSiblings(char const&)' collect2.exe: error: ld returned 1 exit status  but i have no idea why.... my guess is linking but i have check the headers and i still cant see it   my driver.cpp(main)  #include <iostream>  #include <iomanip> #include "BST.h" using namespace std;  int main() {      BST<char> op1;     int action = 0;     int numInsert = 0;     char value;  cout<<"-------------------- MENU ----------------------"         <<endl<<"1. Insert node(s)"         <<endl<<"2. Traverse Preorder"         <<endl<<"3. Search BST"         <<endl<<"4. Delete node"         <<endl<<"5. Leaf Count"         <<endl<<"6. Sibling of a node"         <<endl<<"7. Quit"         <<endl<<"Please ent   switch (action)         {             case 1:                 cout << "\n How many values would you liek to insert to a BST? ";                 cin>>numInsert;                 for(int i =0; i<numInsert;i++){                     cout<<"What value would you like to insert to the list: ";                     cin >> value;                     op1.insert(value); //check                 }                     break;    ...  }   --- BST.h ---  #include <iostream> #include "BSTNode.h"  using namespace std;  #ifndef BINARY #define BINARY  template <typename DataType>  class BST {     public:         BST();         // ~BST();          bool empty() const;         /*------------------------------------------------------------------------             Check if BST is empty.              Precondition:  None.             Postcondition: Returns true if BST is empty and false otherwise.         -----------------------------------------------------------------------*/         void insert(const DataType & item);         void traversePreorder(BSTNode<DataType> * startPoint);         bool search(const DataType & item)const;         bool deleteNode(const DataType & item);         int leafCount(BSTNode<DataType> * startPoint);         DataType getSiblings(const DataType & item);         private:         BSTNode<DataType> * treeRoot;         typedef BSTNode<DataType> * BSTNodePointer;          void search2(const DataType & item, bool & found,  BSTNodePointer & locptr, BSTNodePointer & parent) const;   };   please help

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


Is there a term for when someone asks a question but you know it’s only because they either want you to ask them it back, or they want to answer it themselves? Hope I’ve explained this properly!

In journalistic writing I often see writers, correspondents, and interviewers use questions in non-literal ways.  Of course there are rhetorical questions designed to make a point and not meant to literally elicit an answer.   Instead of that, I have in mind when an interviewer asks a correspondent, "why did she not go to the police?" when the interviewer already knows the story and knows the answer to the question, but wants the correspondent to articulate the answer for the audience's benefit.    Is there a commonly used term for this sort of a question?  A "leading" question generally implies an attempt to manipulate the respondent into giving certain responses, which is not exactly the same as what I'm describing.


I want a dash to be added at the end and beginning of a string.  Example:    "chicken" -> "-chicken-"   "nuggets" -> "-nuggets-"     So I'm pretty much asking for Regexes.

I don't really understand regular expressions.  Can you explain them to me in an easy-to-follow manner?  If there are any online tools or books, could you also link to them?


Generally the refractive index of any lens is greater than air. My question is what will happen if the refractive index of lens is less than unity?

Upon checking the optical properties of different dielectrics, I found the interesting case of $Al_2O_3$. It seems to be reported with a refractive index below 1 in the infrared range of $10 - 12~\mu m$, for example by ,  and . Also the absolute value of the complex index of refraction $\bar n = \sqrt{n^2 + \kappa^2}$ is below 1 at certain wavelengths.    (red: $n$, blue: $\kappa$)  Basic physics tells me that the phase velocity of a EM wave in a dielectric is related to the real part of the refractive index by $$v_{ph} = \frac{c_0}{n}$$  Now obviously, the phase velocity can be above $c_0$, but mostly this happens only in 'strange' cases: in plasmas, active media, metamaterials or magnetic substances. $Al_2O_3$ seems to be neither of those.  Another clue is that this happens around the region where $n$ and $\kappa$ cross - that is also the point where $\varepsilon = 0$ in a Drude metal, and hence the wavelength of the bulk plasmon. Could this therefore just be an effect of the $Al_2O_3$ becoming metallic, as mentioned by @boyfarrell?  What's going on here?


Good day for all.  My question is about the power on a transformer and its functionallity. I know that the power is the same in both inductors (ideally),  if I've a source at 240V/10A then the power is 2400W, when the transformer output is 24V then the current up to 100A.   First question: If I have a circuit that work at 24V, 1A, It will be in fire for the high current?  Second question: If anyone (very tired with the life) took the output filaments, all the 100A current trip across his body and he is over forever?  Well, both questions are the same, I believe. The core is, albeit I've 100A, Can I took only the necessary for my electronic component, always that it will be for 24V?, Is the output current value not important?  Thanks.

Power supplies are available in a wide range of voltage and current ratings.  If I have a device that has specific voltage and current ratings, how do those relate to the power ratings I need to specify?  What if I don't know the device's specs, but am replacing a previous power supply with particular ratings?  Is it OK to go lower voltage, or should it always be higher?  What about current?  I don't want a 10 A supply to damage my 1 A device.


what is the purpose of interface when writing a class?  heres an example i've seen online.  <?php interface Chargeable {     public function getPrice(); }  class Employee implements Chargeable {     protected $price;      public function getPrice() {         return $this->price;     } }  $product = new Employee();  ?>

allow you to create code which defines the methods of classes that implement it. You cannot however add any code to those methods.    allow you to do the same thing, along with adding code to the method.   Now if you can achieve the same goal with abstract classes, why do we even need the concept of interfaces?   I've been told that it has to do with OO theory from C++ to Java, which is what PHP's OO stuff is based on. Is the concept useful in Java but not in PHP? Is it just a way to keep from having placeholders littered in the abstract class? Am I missing something?


While using the command "sed" for find and replace, I wanted to know how one could find a constant and replace it with a variable inside the quotation syntax of sed?  I wanted to replace constant 3 with variable name "hourid" Here is what I tried.  sed -i 's@3@hourid$@g' file_name.txt   I want to know how to provide a right syntax for replacing variable "hourid"

I want to do:  cat update_via_sed.sh | sed 's/old_name/new_name/' > new_update_via_sed.sh   in my program.  But I want to use variables, e.g.  old_run='old_name_952' new_run='old_name_953'   I have tried using them but the substitution doesn't happen (no error). I have tried:  cat update_via_sed.sh | sed 's/old_run/new_run/' cat update_via_sed.sh | sed 's/$old_run/$new_run/' cat update_via_sed.sh | sed 's/${old_run}/${new_run}/'


asks for an idiom for someone getting what they deserve. But what about the feeling one gets when someone else gets "what they deserve"? Is there a specific word or expression for the good feeling you get when justice is served?

Is there a word for the feeling of satisfaction when someone 'bad' gets punished? For example, when watching a movie and seeing the villain finally get defeated, the audience feels a sense of... what?  I thought I've heard of this word before but I can't find anything. Schadenfreude is a bit off and doesn't cover the "good, that guy finally got what he deserved" feeling (there's also a sense of moral superiority involved, I suppose?). I also found vindictive, but that doesn't convey the sense of satisfaction.


the halving of 1/60 is 1/120  then why is that standard 1/125 for a full stop?  is 1/125 really cutting the amount in half?  Thanks

Here are some common shutter speeds you will find on most DSLR cameras:   1/15, 1/30, 1/60, 1/125, 1/250, 1/500, 1/1000, 1/2000, 1/4000   As you move from left to right, or as you increase the shutter speed, you are halving the amount of light that hits the sensor. In other words, you are decreasing the amount of light by one stop for each step. So 1/30 is half of 1/15, and 1/60 is half of 1/30. But then you come to 1/125, which is not half of 1/60. Half of 1/60 is 1/120. This is basic math.  So you break the sequence or pattern. But as you continue, it starts to make sense again. So 1/250 is in fact half of 1/125, and 1/500 is in fact half of 1/250, and 1/1000 is in fact half of 1/500, so on and so forth.  So there appear to be two distinct sequences here.   1/15, 1/30, 1/60 1/125, 1/250, 1/500, 1/1000, 1/2000, 1/4000   Is there a sane reason for this?  I know that people sometimes talk about half stops or even thirds of a full stop. But then what is 1/125 the half stop, or third stop of? If you increase 1/60 by a third you get 1/180. This setting does not exist in the standard sequence. The closest you will get is 1/160. If you increase 1/60 by a half, you get 1/120 and it doesn't exist either.  Is this all arbitrarily set by the camera manufacturers, or is there perhaps some reason and history behind this?


I cannot seem to get my references to load and show in my bibliography:  \documentclass{article} \begin{document}  Here \cite{Franceschini.2008} \bibliographystyle{amsplain} \bibliography{References} \end{document}   I get the warnings that some references were undefined (Line 3 specifically to this one and Line 1 for the "general" warning).  References is my bibliography file, in the same folder as the LaTeX one. Franceschini.2008 is one of the references in it.  I am running PdfLaTeX + BiB(la)TeX(x2) + PdfLaTeX(x2) + View Pdf in TeXMaker, and in other files with this setting the bibliography showed with the corrected citations.

I've browsed the forums and found a number of posts that have addressed this issue, but none of the solutions seem to work for me. I have the following script that I just copied from the bibtex home page to get familiar with it. Instead of the citation number I get a question mark. I compile using Latex+Bibtex+Latex+Latex+PDFLatex+ViewPDF just as has been previously suggested and the problem persists.   \documentclass[11pt]{article} \usepackage{cite}  \begin{document}  \title{My Article} \author{Nobody Jr.} \date{Today} \maketitle  Blablabla said Nobody ~\cite{Nobody06}.  \bibliography{mybib} \bibliographystyle{plain} \end{document}   My bibliography (Bib.bbl)  @misc{ Nobody06, author = "Nobody Jr", title = "My Article", year = "2006" }    Looking at previous posts one thing that is concerning is that my .bbl looks empty as shown below. Further, I don't have a .blg  \begin{thebibliography}{}  \end{thebibliography}


Is there a way to set the gnome-terminal title from within the terminal itself without having to right click on the tab. Something like:  active-terminal --title "Foo"   There was a related question previously with an answer that almost lets you do this:  but that doesn't set the gnome-terminal tab title only the window title.

I have several instances of terminals running in my working environment, what I would like is to set a specific title for each one, in order to have a clear idea what purpose the specific terminal serves i.e. Apache, editing_ini, postgres etc...  Of course from the command line.


I've recently beat the Ender Dragon. I've heard there is a way to respawn her. How do I do that?

I have a server and the Ender dragon has been defeated.  However, returning to The End does not respawn the Ender Dragon.  How can I get the final boss back on a vanilla server without using mods?


I've noticed there is a compilation section in web.config like:  <compilation debug="false" targetFramework="4.5.2">   <assemblies>     <add assembly="DevExpress.ExpressApp.Xpo.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />     <add assembly="DevExpress.ExpressApp.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />     <add assembly="DevExpress.ExpressApp.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />     <add assembly="DevExpress.Persistent.Base.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />   What is it for? Where are these assemblies being added?

When creating a new ASP.NET AJAX Web Application in Visual Studio 2005, the default web.config contains the following section (inside the compilation node):  <assemblies>     <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </assemblies>   Whether or not the assemblies node exists doesn't seem to affect the AJAX functionality.  Update panels, etc work fine regardless of whether or not the reference to System.Web.Extensions is included in Web.Config.  What's the purpose of this section, and can it be safely removed?


I am about to install Ubuntu 10.10 on my Windows 7 system  I will be dual booting with Windows 7 and want to use Windows 7 as my default OS for now. Where should I put the bootloader/GRUB; on the Windows partition or the root partition of Ubuntu? I have read elsewhere that Windows 7 tends to corrupt grub2.  Also, is there a way to use Windows 7's bootloader instead of selecting the OS from grub? I don't know much about bootloaders.

Where is the boot loader, such as Grub, installed generally?   When I install 12.04 along side Windows on different partitions of my disk, I encountered a choice for "Device for boot loader installation". If I understand it correctly, it is to specify where to install the boot loader Grub,  I found on the internet that it is to specify the disk that contains the partitions for the OS, not any partition on the disk. E.g. disk sda, not partition sda1, sda2.  Questions:  I wonder where the boot loader installed actually on the disk?  Is it installed on any of the existing partitions for the OSes and for personal data, or does it have its own partition, which is also visible e.g. from system monitor of Ubuntu?  Thanks and regards!


So if I have the float variable interval and I want to print it, I want it to print with all of the necessary figures and no extra. If I use System.out.printf("%f", interval); where float interval = 15 I get an output of 15.000000. I can fix that by using System.out.printf("%2.0f", interval) to which I get an output of 15, but if I do that then where float interval = 12.05f I get an output of 12. My assignment requires me to use printf().

A 64-bit double can represent integer +/- 253 exactly. Given this fact, I choose to use a double type as a single type for all my types, since my largest integer is an unsigned 32-bit number. But now I have to print these pseudo integers, but the problem is they are also mixed in with actual doubles. So how do I print these doubles nicely in Java? I have tried String.format("%f", value), which is close, except I get a lot of trailing zeros for small values. Here's an example output of of %f  232.00000000 0.18000000000 1237875192.0 4.5800000000 0.00000000 1.23450000  What I want is:  232 0.18 1237875192 4.58 0 1.2345  Sure I can write a function to trim those zeros, but that's lot of performance loss due to string manipulation. Can I do better with other format code?  The answers by Tom E. and Jeremy S. are unacceptable as they both arbitrarily rounds to two decimal places. Please understand the problem before answering.  Please note that String.format(format, args...) is locale-dependent (see answers below).


If $a,b,c,d$ are positive real numbers, can we say that $\frac{a+b}{c+d} \leq \frac{a}{c} + \frac{b}{d} $ is always true? If no, can you please give insignts on under which conditions this might be true.   Any references to a similar type of inequalities are also welcome  Thank you,

Is $$\frac{a+b}{c+d}<\frac{a}{c}+\frac{b}{d}$$ for $a,b,c,d>0$  If it is true, then can we generalize?  EDIT:typing mistake corrected.  EDIT, WILL JAGY. Apparently the real question is  Is $$\color{magenta}{\frac{a+b}{c+d}<\frac{a}{c}+\frac{b}{d}}$$ for $a,b,c,d>0,$ where letters on the left hand side and in the numerator stay in the numerator on the right-hand side, and letters on the left hand side and in the denominator stay in the denominator on the right-hand side.


I'm trying to import an FBX model to Blender and when I do, it just completely messes up the materials. I know what shaders the model uses (which are custom) but I want to know if there's a way I can change the shader within Blender/change whatever to stop the materials to look like this.

I used node textures in a mesh I exported to .FBX.  I then imported it into Unreal Engine 4 and it didn't import any textures; I clicked the Upload Textures option in Unreal Engine.  Is there something I'm doing wrong or is it Blender?


I use Ubuntu 18.04 LTS and GNOME 3 and I found that different from Windows. When I press the right mouse button, the right click menu gets  out. After I release that button, if the mouse pointer is on any menu item, that item will be choose which is not I want.  I want to know how to set the menu popped out after the right-click being done (when releasing the right mouse button).

I'm trying to change the behavior of the right click menu in ubuntu 10.10 because I use Windows 7 and Ubuntu.  When you right click you need to hold the right click and select something.  In Windows the is different right click (release) select something with left click  Is there a way to change this in ubuntu?  I'm running the ubuntu in vmware 7  Is that behavior normal?


I have a style tag in my html document what looks like that:  <style>      #workspace a:not(.notClickable){color:#c75858 !important; text-decoration: underline; !important;}       #workspace a:not(.notClickable):hover {color:#c75a1b2 !important; text-decoration: none; !important;} </style>   How can I read values:  color:#c75858  text-decoration: underline  color:#c75a1b2  text-decoration: none   into variables using jQuery?

I would like to return a string with all of the contents of a CSS rule, like the format you'd see in an inline style. I'd like to be able to do this without knowing what is contained in a particular rule, so I can't just pull them out by style name (like .style.width etc.)   The CSS:  .test {     width:80px;     height:50px;     background-color:#808080; }   The code so far:  function getStyle(className) {     var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules     for(var x=0;x<classes.length;x++) {         if(classes[x].selectorText==className) {             //this is where I can collect the style information, but how?         }     } } getStyle('.test')


Show that for each $r> 0$ $$\mathbb{E} |X+Y|^r \leq c_r (\mathbb{E} |X|^r + \mathbb{E} |Y|^r),$$ where $c_r$ is a constant given by \begin{equation}    c_r = \left\{         \begin{array}{ll}    1 & \mathrm{if\ } 0 < r \le 1 \\    2^{r-1}     & \mathrm{if\ } 1 < r         \end{array}       \right. \end{equation} I've tried to use other inequalities for the proof of this one but I still get stuck for the case of $2^{r-1}$.

How does one prove:   $$ E(|X+Y|^r)\leq c_r\bigg[E(|X|^r)+E(|Y|^r)\bigg] $$   where $c_r=1$ if $0<r\leq 1$ and $2^{r-1}$ if $r>1$?   This is a classic result whose proof I once knew but have since forgotten. Can someone please explain so I could learn it again? Thank you.