How to calculate Camera “correct” position and distance to Frame all my Scene?
How to calculate Camera "correct" position and distance to Frame all my Scene?
How far do you go with const?  Do you just make functions const when necessary or do you go the whole hog and use it everywhere?  For example, imagine a simple mutator that takes a single boolean parameter:  void SetValue(const bool b) { my_val_ = b; }   Is that const actually useful?  Personally I opt to use it extensively, including parameters, but in this case I wonder if it's worthwhile?  I was also surprised to learn that you can omit const from parameters in a function declaration but can include it in the function definition, e.g.:  .h file  void func(int n, long l);   .cpp file  void func(const int n, const long l)   Is there a reason for this? It seems a little unusual to me. I am reading through a directory with some pictures and such using a pretty simple implementation of readdir() like the following:  if ($handle = opendir($path)) {     while (false !== ($szFilename = readdir($handle))) {     if ($szFilename[0] !== '.') {         if (is_file($path.$szFilename)) {                 // do stuff             }         }      }  }   The problem that I am having is that the files are not being read in alphabetical order as the docs for readdir() state:     Returns the filename of the next file   from the directory. The filenames are   returned in the order in which they   are stored by the filesystem.   Another weird thing is that, on the local testing server, the same code works great.  This is running on a server using the LAMP stack in both cases.  I know that I can build an array and just sort it, but I was wondering if I was missing something in what I was doing. Mirror Modifier making ugly smoothing on mirrored faces The model is vivisected right down the middle along the z axis. The right leg is rendering funny and I assume if I can get that fixed everything else will fall into place. I tried flipping normals, changing shading types - can't think of anything else to do. How do I make Ubuntu not require a password to supend? Repairing corrupt MP4 I took a video from my Android phone (Sony Xperia P, if you need to know), and before I could stop recording it, the phone memory got full and the phone got hanged too. I rebooted the phone, the video was there, but I couldn't play it from any media player on Android. It's in mp4 format.    So I tried to open it on PC and Mac with different video player, like VLC, quick Time, Windows Media Player etc., but none of them can play it. I know that the video is corrupted, but I believe it's repairable, since it got more than a GB in size. Is there anything that I can try  to repair the video file? The video is really important. If I have example.com, and blog.example.com, do search engines see those as one site or two? Will using subdomains hurt SEO? I have some technical reasons why I can't use example.com/blog. Why is travelling around the speed of light a problem? I don't fully understand what would happen if we could travel at the speed of light. But I saw somewhere here that it would mean events happen out of order. But why is this a problem. It is said that cause has to happen before the effect, but why does this have to be linear?   And why is it that the speed of light is the maximum? I take it that light (photons?) are massless, so why can't they travel faster? Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter [168c:003e] (rev 32) can't enable wi-fi Install Ubuntu, you can not continue Color gradient for bars in pgfplots I want that each bar in my diagram has a color gradient from black to white (from left to the right). However, for the following code, the gradient exists for the entire diagram such that the left bar is black, the middle one is gray, and the right one is white.   \documentclass{report}  \usepackage{pgfplots}   \begin{document}  \begin{tikzpicture}      \begin{axis}[ybar]          \addplot[left color=black,right color=white] coordinates {(1,2) (2,3) (3,4)};      \end{axis}  \end{tikzpicture}  \end{document} Iterating each character in a string using Python $a$ and $b$ are natural numbers and $p$ is a prime number. Prove that if $a^{p}-b^{p}$ is divisible by $p$, then it is also divisible by $p^{2}$.  My attempt: Based on Fermat's theorem $(a^{p}-a)$ and $(b^{p}-b)$ are divisible by p, therefore their difference is divisible by $p$. I.e. $(a^{p}-a)-(b^{p}-b)=(a^{p}-b^{p})-(a-b)$ is divisible by $p$. Since the left hand side of this equation is divisible by $p$, the right hand side also should be divisible by $p$. Based on the problem's assumption $(a^{p}-b^{p})$ is divisible by $p$ therefore we conclude $(a-b)$ must be divisible by $p$. Now We can factorize $(a^{p}-b^{p})$ $$(a^{p}-b^{p})=(a-b)(a^{p-1}+a^{p-2}b+....+b^{p-1})$$ we have to prove $(a^{p}-b^{p})$ is multiple of $p^2$ which means we have to show the right hand side should be multiple of $p^{2}$. But $(a-b)$ is multiple of p therefore we have to show  $(a^{p-1}+a^{p-2}b+\cdots+b^{p-1})$ is multiple of $p$ and I am stuck here. Any help would be appreciated. Is Dragonstone unoccupied after Stannis Baratheon's defeat? Is anything known about Dragonstone after:      Stannis Baratheon is killed in his bid for the Iron Throne?   As the seat of the naval defense of King's Landing and the birthplace of Daenerys Targaryen, she has a vested interest in taking it.   At the conclusion of Season 6 Episode 10, is Dragonstone unoccupied? Multiple tags search broken when searching as anonymous user? When I input [asdf][lisp] into the search field on , without being logged in, only one tag remains. Is it broken? Is there an (easy) way to create or personalize .bst files? When you prepare an article for a journal (in my case, Quantum Information and Computation, Rinton Press), often they ask you to use some format for your references; in my case, the following:     [1] R. Calderbank and P. Shor (1996), Good quantum error          correcting codes exist,  Phys. Rev. A, 54, pp. 1098-1106.      [2] M.A. Nielsen and J. Kempe (2001), Separable states   are  more disordered globally than locally, quant-ph/0105090.      [3] A.W. Marshall and I. Olkin (1979), Inequalities:   theory of majorization and its applications, Academic Press (New   York).   The issue is, sometimes (and this is the case) they do not provide a .bst style file for bibtex users. I (and I guess many other people) prefer not to copy all the references of a bibtex file one by one into a tex document. So here is the question I am trying to answer:     What is the easiest way to create a .bst file? (for Rinton or any other publisher)   At first sight, I thought this would be very easy to do: after all, a .bst file is just a mere script to give format to a list. Strangely to me, after a long search I have been unable to find a simple clean solution to this problem. These are the the options I have been looking at:   I have tried to adapt a previous .bst file: concretely, apsrev4-1.bst, which has a similar format. Other people have tried this solution before , . However, it is an ugly option. First, it requires going through the script of the .bst and understanding it. Second, the script format used in different .bst files differs (quite annoyingly), so it is not easy to modify them unless you do understand what's written. The above solution is quite hideous and you really lose time on it, so I was wondering: isn't there any software tool (hopefully with a GUI) that does this job? It should, after all, pretty easy to program for a .bst script expert some sort of program to generate .bst files. There are some related questions in this site asking for something similar , ; there I have seen a couple of proposed apps, but going through their manuals they seem not so easy to use. Isn't there some software tool available to generate a .bst in less than 1 hour of work?   Remarks: ideally I would like to use/personalize/create .bst styles that support eprint fields (e.g. aps4-1.bst). How do I write content to another browser window using Javascript? I've opened a new window with window.open() and I want to use the reference from the window.open() call to then write content to the new window.  I've tried copying HTML from the old window to the new window by using myWindow.document.body.innerHTML = oldWindowDiv.innerHTML; but that's doesn't work.  Any ideas? When a player joins the server, this command block (containing gamemode 2 @a) puts them into gamemode 2/adventure mode. How can I change this so that only non-admin/not "opped" players' gamemode gets changed? Splitting a string into words and punctuation I'm trying to split a string up into words and punctuation, adding the punctuation to the list produced by the split.  For instance:  &gt;&gt;&gt; c = "help, me" &gt;&gt;&gt; print c.split() ['help,', 'me']   What I really want the list to look like is:  ['help', ',', 'me']   So, I want the string split at whitespace with the punctuation split from the words.  I've tried to parse the string first and then run the split:  &gt;&gt;&gt; for character in c: ...     if character in ".,;!?": ...             outputCharacter = " %s" % character ...     else: ...             outputCharacter = character ...     separatedPunctuation += outputCharacter &gt;&gt;&gt; print separatedPunctuation help , me &gt;&gt;&gt; print separatedPunctuation.split() ['help', ',', 'me']   This produces the result I want, but is painfully slow on large files.  Is there a way to do this more efficiently? Why does PGFplots not recognize my expression? Remove items from one list in another