output is proper but showing runtime error in c
What should main() return in C and C++?
I wrote a script to create a big number of heat maps for a given scenario. I would like to save the result of every heat map as an PNG image. I have figured it out doing it with simple Map Rendering but the quality of the result is too low. Furthermore I would like to export to OpenLayers using the same code, which does not seem to be possible with simple rendering.   Now I am trying to do it with QgsComposition instead. Manually in the Map Composer you can just set the paper color to transparent and disable the background of the map canvas.   This is the code that I have so far. I just cannot figure out why it is not working. The result png-file always has a white opaque background.   My OS is Windows 7 and I'm using QGIS 2.6 Brighton.  I hope someone can help me out here.  # PARAMETERS mainPath = 'path/to/folder/' filename = 'filename' imageType = "png" imageWidth_mm = 400 imageHeight_mm = 160 dpi = 300  mapRenderer = iface.mapCanvas().mapRenderer()  c = QgsComposition(mapRenderer) c.setPlotStyle(QgsComposition.Print)  c.setPaperSize(400, 160)  x, y = 0, 0 w, h = c.paperWidth(), c.paperHeight() composerMap = QgsComposerMap(c, x ,y, w, h) c.addItem(composerMap)  # get all items and disable the backgrounds itemList = c.items() c.removeItem(itemList[2]) c.removeItem(itemList[2]) itemList[2].setBackgroundEnabled(False) itemList[3].setBackgroundEnabled(False) # add them to the composition c.addItem(itemList[2]) c.addItem(itemList[3])  c.refreshItems() c.refreshDataDefinedProperty(QgsComposerObject.AllProperties)  c.setPrintResolution(dpi) dpmm = dpi / 25.4 width = int(dpmm * c.paperWidth()) height = int(dpmm * c.paperHeight())  # create output image and initialize it # image = QImage(QSize(width, height), QImage.Format_ARGB32) image = QImage(QSize(width, height), QImage.Format_ARGB32_Premultiplied) image.setDotsPerMeterX(dpmm * 1000) image.setDotsPerMeterY(dpmm * 1000) #image.fill(0)  imagePainter = QPainter(image)  # This part does not seem to have any effect #brush = QBrush(Qt.BrushStyle(0)) # transparent brush # #imagePainter.setBackgroundMode(0) #c.setBackgroundBrush(brush)  c.renderPage( imagePainter, 0 ) imagePainter.end()   imageFilename =  mainPath + filename + '.' + imageType image.save(imageFilename, imageType) print 'image saved' print 'done' How secure is Activation Lock on iOS 7 (and later)? For simple linear regression, the regression coefficient is calculable directly from the variance-covariance matrix $C$, by  $$ C_{d, e}\over C_{e,e} $$ where $d$ is the dependent variable's index, and $e$ is the explanatory variable's index.  If one only has the covariance matrix, is it possible to calculate the coefficients for a model with multiple explanatory variables?   ETA: For two explanatory variables, it appears that $$\beta_1 = \frac{Cov(y,x_1)var(x_2) - Cov(y,x_2)Cov(x_1,x_2)}{var(x_1)var(x_2) - Cov(x_1,x_2)^2} $$ and analogously for $\beta_2$. I'm not immediately seeing how to extend this to three or more variables. Is there a max array length limit in C++? How to Achieve this Requirement ???Can i use Jave Script , CSS and Visual force page? I'm writing a technical documentation and I want to explain step-by-step how to go through various menus.  For example I used to write Open with &gt; VLC media player.  That's how it looks in Windows 8:     What I want in Latex should looks similar to this: light grey box, dark grey border and black windows-like font.    I've seen , suggesting the package  - but it looks very old fashioned - are there any more modern approaches? So I am using  package for code examples. But there is a problem. When I copy the code examples from the final PDF document, they are usually not the same - the indentation is gone, there are random spaces after parenthesis, etc. Does anyone know how to make sure that the code that I copy from the final document is the same as I wrote it in the LaTeX document?  Here is what I mean. Compile this document:  \documentclass[12pt,oneside]{memoir}  \usepackage{listings} \usepackage[T1]{fontenc} \usepackage{xcolor} \usepackage{textcomp}  \definecolor{codebg}{HTML}{EEEEEE} \definecolor{codeframe}{HTML}{CCCCCC}  \lstset{language=Awk} \lstset{backgroundcolor=\color{codebg}} \lstset{frame=single} \lstset{framesep=10pt} \lstset{rulecolor=\color{codeframe}} \lstset{upquote=true} \lstset{basicstyle=\ttfamily} \lstset{showstringspaces=false}  \begin{document}  This code example prints out all users on your system:  \begin{lstlisting}[language=c] #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  #define MAX_LINE_LEN 1024  int main() {     char line[MAX_LINE_LEN];     FILE *in = fopen("/etc/passwd", "r");     if (!in) exit(EXIT_FAILURE);      while (fgets(line, MAX_LINE_LEN, in) != NULL) {         char *sep = strchr(line, ':');         if (!sep) exit(EXIT_FAILURE);         *sep = '\0';         printf("%s\n", line);     }     fclose(in);     return EXIT_SUCCESS; } \end{lstlisting}  \end{document}   Now compile it, open it, select and copy the code example and paste it in a text editor. Here is the result I get:  # include &lt;stdio .h&gt; # include &lt;stdlib .h&gt; # include &lt;string .h&gt; # define MAX_LINE_LEN 1024 int main () { char line [ MAX_LINE_LEN ]; FILE *in = fopen ("/ etc / passwd ", "r"); if (! in) exit ( EXIT_FAILURE ); while ( fgets (line , MAX_LINE_LEN , in) != NULL ) { char * sep = strchr (line , ':'); if (! sep ) exit ( EXIT_FAILURE ); * sep = '\0 '; printf ("%s\n", line ); } fclose (in ); return EXIT_SUCCESS ; }   Jeez! What's this... The indentation is gone. There are spaces in included headers &lt;stdio .h&gt;, there are spaces after parenthesis [ MAX_LINE_LEN ].  Anyone knows how to fix this? I'd like the code examples in my book to be copy/paste-able into a text editor so people can try them out easily. My website's google cache copy looks broken.   Below is link to cache.  http://webcache.googleusercontent.com/search?q=cache:http://paintcollar.com  Can this affect the SERPs and crawling by google?  What can I do to rectify it?  PS. Few pages are being cached properly though.Below is URL to one such page. http://webcache.googleusercontent.com/search?q=cache:http://paintcollar.com/aneel If I have a Type C visa from the Norwegian embassy valid for February 9-28, and my Type D national visa from the German embassy valid from March 1 - August 31, 2017, do I need to leave/fly out of the Schengen area on the 28th and fly back on the 1st day of March? Is it possible to have the dock in different positions in different desktop? Is it possible to have the dock in different positions in different desktops? In particular I'd like to change the settings between a normal desktop and a desktop where there's an app at full screen. In this way I'd keep the dock in lower side of the desktop when there's an app at full screen and vertically on the left side during normal use.  I have this problem that, sicne I usually have the dock vertically on the left, it pops out everytime i go to the far left in an app I'm using with full screen, and using this app I have to move the mouse to the left quite often. Divisibility by 7 rule, and Congruence Arithmetic Laws Self-Studying Measure Theory and Integration As the title says, I'm interested in reading about measure theory and integration theory on my own time, and was hoping for book recommendations, prerequisites, and things like that.  As for my background, I've taken introductory analysis, where we covered the "typical" subjects up until some theorems about differentiable functions.  I'm taking intermediate real analysis now; we talked about metric spaces in general for a while, but lately we've focused solely on $\mathbb{R}^n$. Now we're working towards a proof of the implicit function theorem in $\mathbb{R}^n$.  I haven't learned any of the theory behind Riemann integration, unfortunately. Is it important to be familiar with this first? The following could have shown up as an exercise in a basic Abstract Algebra text, and if anyone can give me a reference, I will be most grateful.  Consider a set $X$ with an associative law of composition, not known to have an identity or inverses. Suppose that for every $g\in X$, there is a unique $x\in X$ with $gxg=g$. Show that $X$ is a group.  Note that I’m not asking for a proof (though a really short one would please me!), just some place where this has been published. Foobar2000-like music player? What *is* an Artificial Neural Network? Constructing a continuous distribution to match $m$ moments Bounded in Probability and smaller order in probability $$\lim_{n\to \infty}\frac1{2n}\log\left({2n \choose n}\right)$$  Now, $\log(n!) = \Theta (n\log(n))$ so I think we could write,   $$\lim_{n\to\infty}\frac{1}{2n}\left(\log\left(2n!\right) - \log\left(n!^2\right)\right) = \frac{1}{2n}\left(\log\left(2n!\right) - 2\log\left(n!\right)\right) $$  $$\lim_{n\to\infty}\frac{1}{2n}\left(2n\log\left(2n\right) - 2n\log\left(n\right)\right) $$  $$\log\left(2n\right) - \log\left(n\right) = \log(2)$$  Is this legitimate? I feel this might be wrong since, the $\Theta$ notation conceals a constant factor. I have an uploaded video and I want to cut sections of audio (strong language) or add beeps on top without reuploading the video. Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit? I am being considered for a very nice industry scientist position but this involves many interviews and assessments and can take some time.  However I have also accepted an invitation to the US (I'm in Australia) to give a presentation in relation to high likelihood of employment as a postdoc in a research institute.  The postdoc supervisor has arranged for sightseeing and lab visits and hotels. I feel bad if somehow I wish to pursue the industry position.  Has anyone had a similar experience and have you turned down something like that before?