I'm not sure whether it's appropriate to ask this here. I'm concerned about the memory allocation and I don't know where to read up on that.  I'm debating with myself whether I should declare local variables per root-finding function, or just use global variables that each function can reuse per call. Please note that I don't plan on using recursion here. Just (do-)while (or for) loops only.  I'd really appreciate it if I can get sufficient explanation too.  // [1] // global(?) variables // functions.cpp  #include &lt;cmath&gt; #include "functions.h"  using namespace std;  double guess1;     // upper double guess2;     // lower double root; double prevGuess; double sigFigs; double minSigFigs;  double newt_rhap(params) {    // do stuff } double bisection(params) {    // do stuff }   ===============  // [2] // local variables // functions.cpp  #include &lt;cmath&gt; #include "functions.h"  using namespace std;   double newt_rhap(x,y,z,f(),f_prime()) {    double guess = x;    double sigFigs = y;    double minSigFigs = z;     // do stuff } double false_position(w,x,y,z,a()) {    double xr;    double upper = w;    double lower = x;    double xprev;    double fxr;    double fxu;    double fxl;    double sigFigs = y;    double minSigFigs = z;     // do stuff }
In C/C++, are global variables as bad as my professor thinks they are?
How do I turn off some formats in GeoServer's WMS? I have published a couple of layers on my Geoserver.  To be complaint with the T&amp;C of my data provider, I need to block the access of some of those layers as Vector data. Hence I have already blocked the WFS services on these Layers.  I came to know that even on the WMS service, you can get Vector Data, if you use GeoRSS and some of the .   How do I block GeoRSS, SVG &amp; UTFGrid as formats in the WMS Service? Headless linux install Java - Screen turns black, when setting a JFrame to Fullscreen Should I use "got" or "gotten" in the following sentence? how i evaluate this integral with integration by substitution $x=\frac{\pi}{2}-t$  $$\int _0^{\frac{\pi }{2}}\:\frac{\sqrt[3]{\sin^2\left(x\right)}}{\sqrt[3]{\sin^2\left(x\right)}+\sqrt[3]{\cos^2\left(x\right)}}dx$$ What's a good Windows RDP client for Mac? I administer a number of Windows machines, and am trying to find a really good application to remote desktop in to them from my Mac.  I've tried CoRD, and I really like its library approach to saved sessions (as opposed to Microsoft's file based approach), and tabbed sessions are great when working on a bunch of machines.  Unfortunately, it's just too buggy for serious use, and given that it averages less than 2 releases a year, I have little hope that that will change.  Microsoft's official client is very bare bones and doesn't support connecting on non-standard ports (which I need).  Is there a remote desktop client for Mac out there that's both fully featured and not buggy?  Edit: Apparently the Microsoft doc I read that states that the Microsoft RDC client can't be used on non-standard ports is out of date. As I understand it Q&amp;A style questions are  but a self answered question should be judged independently of the answer. Often after I've solved a problem I would like to share the question and answer on stack overflow (and have on a couple of occasions) but how to show &quot;minimal understanding of the problem&quot; is always challenging. For example I have been looking into the following question  How can I plot a straight line in the JMonkey Engine library I'm trying to plot straight lines between vertices that I specify using the JMonkey Engine 3D graphics library. So for example if I was to try to plot between: (2,0,0) (-1,0,1) (0,1,1) (1,1,1) (1,4,0) Then I would get:   This is something I do (and forget how to do) relatively often and the answer is harder to find than you'd imagine ( provides everything needed to figure it out but its spread out over several posts and isn't a complete solution on its own). Therefore I want to provide a Q&amp;A for it but at present this question feels like it would fail the minimal understanding test  Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work  Should I make up some imaginary problem? (Probably the final source code messed up a bit) Or mention in the question that I’m self answering to assuage some of the normal &quot;This is not a do your work for you site&quot; comments. Assign z values to depth curves in QGIS I'm new to QGIS and working with GIS in general (student of architecture), so please bear with me.  I have obtained shapefiles with topographic curves of an ocean floor. My intention is to export these as CAD files and render as 3D models of the ocean floor in Revit. I have done this procedure earlier with terrain shapefiles. My problem now is that these files mapping depth does not contain z values, so when exporting them into CAD they are completely flat rather than 3D models.  The depth information in meter exists as attributes in the file (see attached image). What I want is to transform this depth value into real z coordinates for each line so that the curves have different heights when importing as CAD file in Revit.  Thankful for any pointers in the right direction. Does the hom-tensor adjunction hold for $O_X$ modules also? With sheaf hom and sheaf tensor product, the statement would consist of a natural transformation $Hom_O (M \otimes_O N, K)\cong_{nat} Hom_O(M, Hom_O(N, K))$, $O = O_X$ is the structure sheaf and $M,N,K$ are sheaves of $O_X$ modules.  If true I think I can check this by hand, by describing sheaves in terms of compatible germs, defining this adjunction on the germs and checking that they glue together. It is easier in the quasi-coherent sheaves on a scheme case because then one can just work in an affine cover and the distinguished base.  I am little bit concerned that one might need a finite presentation hypothesis somewhere, in order for $Hom$ to localize well. ($Hom_{R[S^{-1}]}(M[S^{-1}], N[S^{-1}]) \cong Hom_R(M,N)[S^{-1}]$ needs $M$ finitely presented.) How can I stand on the ground? EM or/and Pauli? There is this famous example about the order difference between gravitational force and EM force. All the gravitational force of Earth is just countered by the electromagnetic force between the electrons on the surface of my feet and the ground.  But also wave-function of electrons(fermions) do not overlap each other due to Pauli exclusion principle.  So which one is the true reason of me not flopping inside the earth forever? Is it only one of them(my guess is Pauli exclusion) or is it both? We have a SQL Server 2012 instance that contains a database with data for many product lines.   We are looking for a way to take subsets of this data into another database on the same instance.  This doesn't have to be continuous as we are looking for ways to make it easy to export backups of the subsets that we can send out to vendors (we have a company that loads this data into their own sql server to produce a product we sell, naturally its huge and we want to trim it down to just the product lines they work with on a regular enough basis) or use to load SQLite DB's for use with offline applications.  ProductDB - the superset of all product line data.  ProductLine1DB - A subset identical in structure to ProductDB, but with data only relevant to product line 1.  ProductLine2DB - A subset identical in structure to ProductDB, but with data only relevant to product line 2.  This can be done nightly, weekly, as often as we need to but not a continuous replication.  We don't want to add in distributor servers or even extra subscriber servers. We would like the replication to happen on the same server with the subscriber databases being on the same server.  Is this a good candidate for transactional replication?  Why or why not?  We obviously have other options to load this data, but it seems like this might be a good case to use something like transactional replication. I've heard its powerful but prone to issues when not setup optimally.  Note: I am not a DBA, simply a developer, but we are currently looking for a new DBA and some of us are taking over duties like this temporarily. Recursively delete empty directories in Windows I have a directory on my Windows 7 machine that has hundreds if not thousands of sub-directories.  Some of them have files, some do not.  I want to delete all the empty directories.  Looking at the del and rmdir DOS command, it does not look like you can recursively do this without deleting all the files.  Is there a way to do this from the command line? Is every metric space a subspace of some connected metric space? Is every metric space a subspace of some connected metric space? If the space itself is connected then we're done, but if not then I think we can extend our metric space to make it connected.  I'm not sure whether this will work or not, but intuitively I think the answer is yes. Do I need to license fonts included with my OS? When is $\mathbb{F}_p[x]/(x^2-2)\simeq\mathbb{F}_p[x]/(x^2-3)$ for small primes? I get this error whenever I try to install programs using the terminal:  home@ubuntu:~$ apt-get install myunity E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?   Also I'm unable to install updates using the terminal. How do I change permissions on a FAT32 formatted drive? Will running a large query on a secondary database in an availability group affect transaction performance in the primary database? I need to provide real-time, or almost real-time, data for SSRS and Tableau reporting. I don't want the production OLTP system to be negatively impacted by long running queries. Will running a large query on a secondary database in an availability group affect transaction performance in the primary database? Deserialize JSON object into dynamic object using Json.net For $X$ and $Y$ random variables; $X$ follows the uniform distribution.  (1): if $Y=-\log X$  (2): then it can be shown that $-\log X$ is distributed as $\exp(1)$ {i.e. exponential with mean 1}.  Why is this so? Intuitively statement (2) make sense to me. But i'd like a mathematical proof.  -Probably wrong working:  (1) seems to imply $\exp(-Y) = X$ (which is like saying $X$ is exponentially distributed, which is a contradiction, since its actually uniform!); or is it incorrect for me to do this since $X$ and $Y$ are random variables?  Ultimately how do I prove (2)?  Thanks