I have a .py config file that sets up a set of global variables. Among them is a variable called nMin. kNeighbors is another global variable defined in the exact same way as nMin. All the other variables included in the block are local variables   for i in range(PopLength):     noveltyMetric[i] = np.average(behavior[i][0:kNeighbors])     if noveltyMetric[i] &gt; nMin:         ...   In the loop, the program references kNeighbors with no issue, but on the next line I get the error:      local variable 'nMin' referenced before assignment"   I'm running this in PTVS 2017 and when it stops &amp; displays the bug (while paused on that line), I call nMin in the "Immediate Window" and it calls the value correctly with no error. When I call the statement noveltyMetric[i] &gt; nMin it returns a Boolean with no error. But for some reason it still fails to execute the line in the code and insists I'm referencing it before it's defined.
The following code works as expected in both Python 2.5 and 3.0:  a, b, c = (1, 2, 3)  print(a, b, c)  def test():     print(a)     print(b)     print(c)    # (A)     #c+=1       # (B) test()   However, when I uncomment line (B), I get an UnboundLocalError: 'c' not assigned at line (A). The values of a and b are printed correctly. This has me completely baffled for two reasons:   Why is there a runtime error thrown at line (A) because of a later statement on line (B)? Why are variables a and b printed as expected, while c raises an error?   The only explanation I can come up with is that a local variable c is created by the assignment c+=1, which takes precedent over the "global" variable c even before the local variable is created. Of course, it doesn't make sense for a variable to "steal" scope before it exists.  Could someone please explain this behavior?
macro definition containing #include directive Is there a way to define a macro that contains a #include directive in its body?  If I just put the "#include", it gives the error  C2162: "expected macro formal parameter"   since here I am not using # to concatenate strings. If I use "\# include",  then I receive the following two errors:  error C2017: illegal escape sequence error C2121: '#' : invalid character : possibly the result of a macro expansion   Any help? Natbib puts reference data one line per item I'm using:  \documentclass[oneside,article,openbib,12pt,titlepage]{memoir} \usepackage[authoryear,round]{natbib} % Better bibliography support \bibpunct{(}{)}{,}{a}{,}{,}   in the preamble of my document and  \backmatter \renewcommand{\bibname}{References} \bibliographystyle{chicago}    \bibliography{listb,mybib}   in the body of the file. But a typical formatted reference is:     Freely, I. (1997).   A small paper.   The journal of small papers -1. to appear.   I've tried other non-natbib styles (e.g., regstud), and the reference flows and wraps as it should. So how does one get natbib to do the same?  Also, how does one get natbib to include the authors' entire first names? Plotting layer given with Longitudes [0 360] to [-180 180]? I have a world map in correct Longitudes from -180° to 180°. Additionally, I have a shapefile of data from South America, which shows at 290° instead of -70°. How can I reproject it using QGIS? In school, I have always seen sets. I was watching a video the other day about functors, and they started talking about a set being a collection, but not vice-versa. I also heard people talking about classes. What is their relation? Some background would be nice.   It has to do with something called Russell's paradox, but I don't know what that is.   I think that the difference between a family and a set is that the former is a function and the latter is a set. Is this right? I am looking for a quick way to sleep without closing the lid, or using the mouse.  If it matters, I have Lion version OS and a MacBook Air. I have been thinking a bit about Morita equivalence   and I would like to know whether it also applies to subrings such as right or left ideals.  And, if so, how specifically? Could you illustrate if with the example of 2x2 matrices with zero entries in the bottom row? Since Morita equivalence concerns non-commutative rings, I am assuming it should apply, but I am just guessing.  Thanks in advance. Indenting a whole paragraph How do I indent a whole paragraph at the same distance from my left margin, with the simplest command or environment? After hitting 80% LTV, my mortgage lender refuses to remove PMI. Any recourse? I recently refinanced my home. At the time based on the appraisal vs. amortization I found I would be stuck with PMI (private mortgage insurance) for about 9 months.  I've paid extra on the mortgage each month and after 7 months I got my LTV (loan-to-value ratio) to be 79%. Yay! So I called Pacific Union and asked for PMI to be removed.  The woman said I'd need to fax in a written request. Then she added that my written request would likely be denied because my account had not been in good standing the last 12 months. I pointed out that I'd only had the loan for 7 months and had never been late, but that didn't seem to matter to her.  So I faxed in my written request. Then I read through all my documentation on my loan. Nowhere did it say that I needed to have the loan for 12 months.  After a week I called them back and they said it would be another week for a decision.  So, I waited another week and called. They now just had a recording saying they were too busy to take a call and I could leave a callback number. I did this and never heard back. I've now tried twice more to call them. Each time I leave a number and each time I don't hear back. So I've fired off a written request again.  At this point we've gone around the horn to the next month and in two short days I'll be paying PMI on March's payment.  Do they have any grounds to not remove PMI? Isn't it federally mandated that PMI must be removed at 80%? Any recourse anyone can think of?  [EDIT] - I heard back from Pacific Union. They state that I did not sign anything agreeing to these terms which is what I was certain of. They state these terms are simply automatic with Fannie Mai backed loans and it doesn't matter if I was informed or not about these terms. They also chose not to hide behind the "no late payments" clause and instead said they were requiring an appraisal to remove PMI. Of course an appraisal is $400 and I'll hit 78% LTV before I would pay that much extra in PMI. I have now contacted a lawyer. I'll update again with whatever opinion the lawyer has and whether I proceed or not.  [EDIT] - I filed a BBB complaint. They waited 30+ days to respond. In their response they indicate that the first woman (and some SE users below) are wrong. The loan does NOT have to be in good standing for 12 months. The loan simply needs no late payments within 12 months. They then hide behind the request for another appraisal as the sole reason to not remove it. I checked with Fannie Mae who backs the loan and was told this is optional per the lender, however the lender can force it and I have no recourse. Additionally, they could have asked for a Broker's Price Option (BPO) or a certificate of value which would cost me hundreds less.   At this point I cannot continue to fight them because the amount of PMI I'll pay until 78% LTV is equal to or less than the appraisal cost of $400.  [EDIT] As of August 2015 I've hit 78% LTV. I called Pacific Union to ensure that the automatic cancellation of PMI had happened. They said no, I'd need to request that in writing. This is a violation of federal law as it's supposed to be automatic. They also said they would still deny it because now they want 24 months of good history. I've sent a threatening letter off and am waiting for a reply. If any lawyers come along and read this I'd sure like to hire you.  [EDIT] After my letter they said they would remove PMI. They did not and I was charged again in September. I called them yet again and complained. They said PMI was going to be removed. They then charged my again in October! I called again. I called again and went berserk on the phone. PMI was finally removed for November 2015. First month without it. What are Harry, Ginny, Ron and Hermione's professions? How do I perform a biographical interview? I have a couple of elderly relatives who have not kept a journal and refuse to write down their "life story." I really would like to know their stories and who they were and who they are. They have their favorite stories that they rehash every time I see them, but I'd like to get more. I have no experience with "interviewing" and am looking for information on how to get their stories. Any websites, books, and or tips\techniques would be greatly appreciated. Why not use the Lagrangian, instead of the Hamiltonian, in nonrelativistic QM? Undergraduate classical mechanics introduces both Lagrangians and Hamiltonians, while undergrad quantum mechanics seems to only use the Hamiltonian. But particle physics, and more generally quantum field theory seem to only use the Lagrangian, e.g. you hear about the Klein-Gordon Lagrangian, Dirac Lagrangian, Standard Model Lagrangian and so on. Why is there a mismatch here? Why does it seem like only Hamiltonians are used in undergraduate quantum mechanics, but only Lagrangians are used in quantum field theory? Negative y value in polar plot I'm having some trouble with polar plots. I have to plot negative values, but without changing direction. I tried to set the ymin value to be negative, but it doesn't work.  \documentclass[10pt,border=10pt]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{polar}  \begin{document} \begin{tikzpicture} \begin{polaraxis}[    xticklabel=$\pgfmathprintnumber{\tick}^\circ$,    ymin=-10,    xtick={0,30,...,330}] \addplot table{    0  -1     30 -2    45 -3    60 -4    75 -5    }; \end{polaraxis} \end{tikzpicture} \end{document}   Any suggestion?  For clarity, this is what I expected. I know empirically that is the case.  I have just developed models that run into this conundrum.  I also suspect it is not necessarily a yes/no answer. I mean by that if both A and B are correlated with C, this may have some implication regarding the correlation between A and B.  But, this implication may be weak.  It may be just a sign direction and nothing else.    Here is what I mean...  Let's say A and B both have a 0.5 correlation with C.  Given that, the correlation between A and B could well be 1.0.  I think it also could be 0.5 or even lower.  But, I think it is unlikely that it would be negative.  Do you agree with that?    Also, is there an implication if you are considering the standard Pearson Correlation Coefficient or instead the Spearman (rank) Correlation Coefficient?  My recent empirical observations were associated with the Spearman Correlation Coefficient. Packet Tracer 7 on Ubuntu 18.04 cannot launch I am having some issues with Packet Tracer 7 on Ubuntu 18.04: when I launch it with ./PacketTracer7 within the /opt/pt/bin directory, it opens but close immediately with a lot of:     "Warning: libpng warning: iCCP: known incorrect sRGB profile"   error msgs on the console.  The thing is, I installed PacketTracer7 on Ubuntu 16.04 and I remember that I had that issue with the libqt5multimedia.so.5 dependency, but I was able to find the solution (thanks to askubuntu and google) by installing the dependencies. So, everything perfect with 16.04.  But I'm a bit lost now. I can't realize where the issue come from, because I know the qt5 libs are installed on the system.  This is what I see when I run dpkg --get-selections:  libqt4-xmlpatterns:amd64            install libqt5concurrent5:amd64             install libqt5core5a:amd64              install libqt5dbus5:amd64               install libqt5gui5:amd64                install libqt5multimedia5:amd64             install libqt5multimediaquick-p5:amd64          install libqt5multimediawidgets5:amd64          install libqt5network5:amd64                install libqt5opengl5:amd64             install libqt5opengl5-dev:amd64             install libqt5positioning5:amd64            install libqt5printsupport5:amd64           install libqt5qml5:amd64                install libqt5quick5:amd64              install libqt5quickparticles5:amd64         install libqt5quicktest5:amd64              install libqt5quickwidgets5:amd64           install libqt5script5:amd64             install libqt5scripttools5:amd64            install libqt5sensors5:amd64                install libqt5sql5:amd64                install libqt5sql5-sqlite:amd64             install libqt5svg5:amd64                install libqt5test5:amd64               install libqt5webchannel5:amd64             install libqt5webkit5:amd64             install libqt5webkit5-dev:amd64             install libqt5widgets5:amd64                install libqt5x11extras5:amd64              install libqt5xml5:amd64       I've tried to uninstall pt and the qt5 libs and install everything again, but nothing... the same issue.  Did anybody install PacketTracer7 on Ubuntu 18.04?  I would be very happy to have your help for doing it!  Thanks and forgive me for my poor english :) When I launch certain programs from the command line like eclipse and document viewer in 11.10 it spews a load of information that seems inconsequential.   Also when they are run in the background they sometimes continue to produce output to the terminal which I am currently working on, which is irritating.  I would like them just launch and keep the background stuff in the background. My reasoning is that if you launch these programs through the GUI (eg double clicking on an icon) these messages are never shown to me, so I don't need them in the command line. Proof that the irrational numbers are uncountable Can someone point me to a proof that the set of irrational numbers is uncountable? I know how to show that the set $\mathbb{Q}$ of rational numbers is countable, but how would you show that the irrationals are uncountable? Give an example of a relation R on $A^2$ which is reflexive, symmetric, and not transitive I am just looking for some clarification on this exercise:  Let $A = \{a,b,c,d\}$. Give an example of a relation $R$ on $A^2$ which is reflexive, symmetric, and not transitive.  I understand that if I was only dealing with $A$ and and not $A^2$ I could give an answer similar to:  $R = \{(a,a),(a,b),(a,d),(b,a),(b,b),(c,c),(d,a),(d,d)\}$  Here $R$ is reflexive, symmetric, and not transitive.  What is confusing me is the fact that we have $A^2$. I am not sure what I am missing here. I am looking through my book to see if I can figure this out, but if someone could help shed some light on this it would be appreciated.  Thanks,  Tony Renaming accessor/mutator methods in Eclipse? Is there any way to automatically rename accessor/mutator when a variable they get/set gets refactored -> renamed (Eclipse 3.4)? How do I list the members of a group? How can I see all the members of a group in Linux? MathJax does not work on question title on Android app Although, the question is displayed correctly with MathJax when opened.   App Version: 1.0.85 Device Manufacturer: Spreadtrum Device Model: Celkon A35K   OS Version: 4.4.2 (eng.root.20140613.225402)