I am showing a subsection of the code where i am defining two functions  defining_polygon_outside_nest and defining_polygon_inside_nest. err is an integer whose values ranges from [0,5]. I define err as a global variable within these functions and want to use this to add specific values in list ants_inroi_outsidenest and ants_inroi_insidenest. Whenever i do this, i am getting an error if for_coordinates_inside_nest((x,y)) is True and err==0: NameError: global name 'err' is not defined. It works fine if i am not using err in function defining_polygon_inside_nest Any suggestions to solve this?  err = 0 def defining_polygon_outside_nest(tag_data):     global err     ants_in_arena = []     ants_inroi_outsidenest = []     for id, (x,y) in tag_data:         ants_in_arena.append(id)         if for_coordinates_outside_nest((x,y)) is True and err==0:             ants_inroi_outsidenest.append(id)      return ants_inroi_outsidenest   def defining_polygon_inside_nest(tag_data):        global err     ants_in_arenai = []     ants_inroi_insidenest = []     for id, (x, y) in tag_data:         ants_in_arenai.append(id)         if for_coordinates_inside_nest((x,y)) is True and err==0:             ants_inroi_insidenest.append(id)     return ants_inroi_insidenest
How can I create or use a global variable in a function?  If I create a global variable in one function, how can I use that global variable in another function? Do I need to store the global variable in a local variable of the function which needs its access?
$ f:\mathbb C\rightarrow \mathbb C$ defined by $f(z)=0$, if $Re(z)=0$ or $Im(z)=0$ and $f(z)=z$, otherwise. Gauss's law not making sense If we have a point charge and outside of it we have a non-conducting Gaussian sphere, then Gauss's law says that the net flux should be zero. I agree that the total field lines coming in are equal to the number of field lines coming out, but isn't it true that the magnitude of the electric field at those segments of the sphere where the field is coming in is greater than those where it is coming out? So when we integrate, wouldn't these areas, having a greater electric field, contribute more to the net flux? I don't see why they would cancel each other out. How do I use Moq to mock an extension method? I am writing a test that depends on the results of an extension method but I don't want a future failure of that extension method to ever break this test. Mocking that result seemed the obvious choice but Moq doesn't seem to offer a way to override a static method (a requirement for an extension method). There is a similar idea with Moq.Protected and Moq.Stub, but they don't seem to offer anything for this scenario. Am I missing something or should I be going about this a different way?  Here is a trivial example that fails with the usual "Invalid expectation on a non-overridable member". This is a bad example of needing to mock an extension method, but it should do.  public class SomeType {     int Id { get; set; } }  var ListMock = new Mock&lt;List&lt;SomeType&gt;&gt;(); ListMock.Expect(l =&gt; l.FirstOrDefault(st =&gt; st.Id == 5))         .Returns(new SomeType { Id = 5 });   As for any TypeMock junkies that might suggest I use Isolator instead: I appreciate the effort since it looks like TypeMock could do the job blindfolded and inebriated, but our budget isn't increasing any time soon. Let $V,W$ be two vector spaces over a field $F$ and let $f:V \to W$ be a linear mapping. I have going over some facts about vector spaces (not necessarily finite dimensional) and I have been trying to apply the rank nullity theorem to derive a simple lemma.  I have not been able to complete the proof and was wondering if I need to use something other then $\ker f + \mathrm{Im}\; f = \dim V$.  How do we show that for ever vector subspace $K \subset W$, $ \dim(f^{-1}(K)) = \dim(K \cap \mathrm{Im}\; f) + \dim( \mathrm{Ker}\; f)$? How to install Windows 8 without the setup DVD that came with my notebook? Does using links to other pages dilute the linking page's link juice/page rank? There are lot's of questions here about passing link juice to other pages, including .  I've read several of them over the months, but I always come away wondering the same question.  Does linking to another page, dilute or burn some of the link juice the linking page has already earned?  For example, if my current page has for example, a link juice of 10, and I link to another page, it passes a certain amount of juice (I'll use 90% as an example) of the linking page's juice, giving the page being linked to a .9 boost in it's own link juice.  However, does that mean the linking page's page's remaining juice is now less than 10?  While some of the questions would imply this to be the case, it seems counter intuitive as no one would ever want to link to any page outside of their own content for fear of losing page rank. Why does `a == x or y or z` always evaluate to True? No Wifi, HP Pavillion 15 Ubuntu 14.04 To change URL to user friendly URL I'm refactoring my ASP.net application from ASP.net 3.5 to 4.0. Also I'm changing the URLs to user friendly URLs /product.aspx?id=100 to /product-name/100.  All my pages are indexed by search engines and the site has already been online for 6 years. I'm planning to do 301 redirect from the old pages to the new one.  I want to make sure I won't lose the rankings and traffic.  Any suggestion how to do it properly? Android Syntax Highlighting? If $f$ is continuous with $f(x) = f(2x),f(1) = 3$, then what is $ \int_{-1}^{1}f(f(x))\,dx$? If $f(x)$ is a continuous function such that $f(x) = f(2x)$ and $f(1) = 3\;,$ Then $\displaystyle \int_{-1}^{1}f(f(x))\,dx$   $\bf{My\; Try::}$ Here $-\infty &lt;x&lt;\infty$ and Given $f(x) = f(2x)$  So Using Recursively $$\displaystyle f(x) = f(2^1x)=f(2^2x)=..........=\lim_{n\rightarrow \infty}f\left(2^{n-1}x\right)$$   OR we can write it as $$f(x) = f\left(\frac{x}{2}\right)=f\left(\frac{x}{2^2}\right)=........=\lim_{n\rightarrow \infty}f\left(\frac{x}{2^{n-1}}\right)$$  Now How can i prove that $f(x)$ is a constant function.  Help me  Thanks I am trying to make a callout to AWS S3 using named credentials and Apex  The named credential is set up as follows  Label: AWS S3 Name: AWS_S3 URL: https://bucket-name.s3.amazonaws.com - Certificate: Identity Type: Named Principal Authentication Protocol: AWS Signature Version 4 AWS Access Key: AKIAxxxxxx AWS Secret Access Key: xxxxxx AWS Region: ap-southeast-2 AWS Service: s3 - Generate Authorization header: true Merge fields in header: false Merge fields in body: false   The Apex class is very simple  HttpRequest req = new HttpRequest(); req.setEndpoint('callout:AWS_S3'); req.setMethod('GET');                        Http http = new Http(); HTTPResponse res = http.send(req);                 System.debug(res.getBody()); return res.getBody();   The response body contains the following:     SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.AKIAxxxxx   I have used the same bucket, endpoint and credentials using Postman and am able to successfully return the list of objects in the bucket so it is not an IAM permissions issue  There have been a couple of similar questions on stackexchange but unfortunately they do not provide any resolution or assistance in this case:    I've tried looking for code samples or further pointers in the Apex documentation but it doesn't really give any further guidance on how to proceed or correctly set this up so I'm a bit stuck How and when does the tracking of shared links work? Can I travel to France with Fiktionsbescheinigung (Fiction Certificate) of Germany Looking for a simple proof that groups of order $2p$ are up to isomorphism $\mathbb{Z}_{2p}$ and $D_{p}$ . I'm looking for a simple proof that up to isomorphism every group of order 2p (p prime) is either $\mathbb{Z}_{2p}$ or $D_{p}$ (The Dihedral group of order 2p).  I should note that by simple I mean short and elegant and not necessarily elementary. So feel free to use tools like Sylow Theorems, Cauchy Theorem and similar stuff.  Thanks a lot! Two definitions of $\limsup$ Can I travel within the Schengen area without a passport if I have my residency permit card? I am currently located in the Netherlands and have lived here for 4 years. I have a working visa for the Netherlands and would like to go on vacation to another country in Europe. I however do currently not have my passport as i sent it to an embassy for a visa application. Will I still be able to travel inside of Europe without a passport if I have my residency ID?  I have a resident permit, not a true Dutch ID. And I own a passport that is currently in transit.  I have called with the KLM and the service employee's conclusion was that I do need to carry my passport with me when i am going to fly, so it seems all I can do is wait and hope my passport is returned to me in the next few days as the amsterdam US consulate (who currently holds my passport) is incredibly difficult to contact for urgent matters. iCloud Drive is stuck uploading items and no longer syncs I got the macOS Sierra update when it went into public beta, and I've been trying to use the automatic .  I've enabled the feature, however since September 7 no files have been uploaded. By this point, the bottom of my Finder windows say:     15.78 GB available on iCloud, uploading 156,106 items (543.2 MB of 543.2 MB)   However the files are never actually uploaded. I keep my screenshots folder on my desktop and I take a lot of screenshots, so I can see that September 7 was the last date any file was actually uploaded.  What should I do? Is there a way I can disable and re-enable the feature without risking loss of data? Are there any solutions to this problem? What should I try? So far I've tried rebooting, and tried software update to macOS 10.12.2 public beta. How to repeat currently typed in parameter on bash console? I was just typing something along the lines of:  mv foo/bar/poit/zoid/narf.txt   and suddenly realized, damn, I have to type large parts of that parameter again  mv foo/bar/poit/zoid/narf.txt foo/bar/poit/zoid/troz.txt   Even with tabcompletion, quite a pain. I know I can copy paste the parameter by mouse-selecting the text and middleclick but that is not good enough. I want to remain on the keyboard.  So is there a way to copy paste the current parameter of the line using the keyboard? what is the difference between "yet" and "still"?   When we can use "still"? and when we can use "yet"?   Are they synonyms or not?  "The plan could yet succeed." Can I use "still" in that sentence instead of "yet"?  "I still don't understand." Can I use "yet" in that sentence too?