For code optimization purposes, I want to create a 2d array that contains 40 equal squares (10x10px). Each square represents 1\40 of the displayed window (400x400px).  I populate the 2d array with the standard double for-loop methodology.      int col = 40;     int row = 40;     int boxSize = 0;     Integer[][] boxes = new Integer[40][40];      for (int i = 0; i &lt; col; i++) {         for (int j = 0; j &lt; row; j++) {             boxes[i][j] = boxSize;             boxSize += 10; //Creates a 10px box.         }         boxSize = 0; //Resets box size for next column     }   There are several circles in this program. We have a ship(circle) that fires missiles(circles) toward enemies(circles).  I want to run collision detection ONLY when there is a bullet + an enemy in one of the squares. This will greatly optimize the code.  The question is... how do I create these squares off of a 2d array? How do I select each square? How do I test if the missiles and the enemies are inside the same square?  Thanks.
Up until now, I implemented all-against-all collision detection in my games. It worked fine.  But I reached a point where implementing this kind of collision detection, makes the game run poorly, because there are two many objects to iterate through and check for collision.  I have searched this site and found something about 'uniform grids'. But I didn't completely understand what it is and how to implement it. Tried to Google it but nothing easy enough to understand came up.  I am a beginner to 2D-game programming. Do you mind trying to explain to uniform-grids, or link me to some good tutorial?  Thanks a lot
What is the formula for percent of frame filled at a specific distance and focal length? I am running Ubuntu 14.04 from Windows, using virtualbox 5.0. I tried several options to make size of Ubuntu in virtual box larger, but none helped so far.   I am using latest virtual box with latest guest add on installed. sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11 I went to Ubuntu 'software and Updates' and made sure that under 'Additional Drivers' tab, 'using x86 visualization solution...' is active. In virtualbox window, under view->virtual screen 1, all 'resize to' options are disabled.   None of these options helped. This is frustrating. Any comments or help? Can the problem be I am using 64 bit system? Does this problem occurs in earlier/later versions? If not, please suggest a 'good' version of Ubuntu for virtualbox. File has different name in terminal and Finder I've just downloaded the driver for my preferred trackball from Logitech. In the Finder, the Installer's filename is Logitech Control Center Installer.app. In the Terminal, ls shows LCC Installer.app. How did this happen? SqlServer: can one table's PK be the FK of two table's? I have three tables project, users and proj_user. The PK of proj_user table is the FK of project and users table's pk e.g.(project_id,user_id)  My question is, is it possible if the project_id and user_id's data is different  like project_id = '12345' and user_id = 'abc987'  Please reply  kind regards Vivek I have the formula $x! + y! = z!$ and I'm looking for positive integers that make it true. Upon  inspection it seems that x = y = 1 and z = 2 is the only solution. The problem is how to show it.   From the definition of the factorial function we know $x! = x(x-1)(x-2)...(2)(1)$  So we can do something like this:  $$ [x(x-1)(x-2)...(2)(1)] + [y(y-1)(y-2)...(2)(1)] = [z(z-1)(z-2)...(2)(1)]$$   we can then factor all of the common terms out on the LHS.  $$ [...(2)(1)][x(x-1)(x-2)... + y(y-1)(y-2)...] = [z(z-1)(z-2)...(2)(1)]$$ and divide the common terms out of the right hand side  $$[x(x-1)(x-2)...] + [y(y-1)(y-2)...] = [z(z-1)(z-2)...]$$  I'm stuck on how to proceed and how to make a clearer argument that there is only the one solution (if indeed there is only the one solution).   If anybody can provide a hint as to how to proceed I would appreciate it. Does the point at which salt is added to a dish affect how the flavor is changed? I rooted my Dream/G1 last night and finally gave up on modding it (not for good mind you, but for the moment) and opted instead to just restore it to factory settings via Settings &gt; SD card &amp; phone storage &gt; Factory data reset, which did solve all the problems I was having with multitasking (and not being able to answer it, etc.)  Curiously, I still seem to have root on the phone, despite having reset it. I'd love to understand how that is possible! Superuser Permissions is the only non-stock app still on the phone, and I'm still able to use su to gain root privileges from adb shell. Is this because BusyBox installs to my SD Card?  My phone works just fine, so this is hardly critical, but the whole exercise was/is about knowing my phone better and this is most def. a mystery. Thanks! Delete Duplicate Rows? I have a column in an Excel spreadsheet with several hundred entries, and some of these entries are duplicated.  I would like to remove all duplicate entries from the column so that each entry remaining is unique.   Is there a way to accomplish this automatically? Search results on https://stackexchange.com are broken because of "insecure content" The search results on  are blocked because of:     [blocked] The page at  ran   insecure content from .   I am using Chrome. Is Switching the Neutral OK? What’s the worst that can happen if i put a switch in the neutral instead of the phase?   I just found out that 3 light bulbs sockets in my home  are connected this way, it first came to my mind to fix it but then I recalled the flow of current from positive to negative is just a convention since the electrons are charged negatively and they actually flow from N to L so i cant really find an solid excuse to mess with the wiring for the next 2 hrs I've gotten stuck at the following exercise;     There are m functions from a one-element set to the set {1, 2, …, m}.   How many functions are there from a two-element set to {1, 2, …, m}?   From a three-element set? Give a recurrence for the number of T(n) of   functions from an n-element set to {1, 2, …, m}. Solve the recurrence.   I'm not sure how to begin solving it? Does $\int_{0}^{\infty}\frac{dx}{1+(x\sin5x)^2}$ converge? I would like your help with deciding whether the following integral converges or not:  $$\int_{0}^{\infty}\frac{dx}{1+(x\sin5x)^2}.$$  I tried to compare it to other functions and to change the variables, but it didn't work for me.  Thanks a lot! Polygon label repeated for each tile This is a  about how Unix operating systems report memory usage.   Similar Questions:                    I have production server that is running Debian 6.0.6 Squeeze  #uname -a  Linux debsrv 2.6.32-5-xen-amd64 #1 SMP Sun Sep 23 13:49:30 UTC 2012 x86_64 GNU/Linux   Every day cron executes backup script as root:  #crontab -e  0 5 * * * /root/sites_backup.sh &gt; /dev/null 2&gt;&amp;1   #nano /root/sites_backup.sh  #!/bin/bash str=`date +%Y-%m-%d-%H-%M-%S` tar pzcf /home/backups/sites/mysite-$str.tar.gz /var/sites/mysite/public_html/www mysqldump -u mysite -pmypass mysite | gzip -9 &gt; /home/backups/sites/mysite-$str.sql.gz cd /home/backups/sites/ sha512sum mysite-$str* &gt; /home/backups/sites/mysite-$str.tar.gz.DIGESTS cd ~   Everything works perfectly, but I notice that Munin's memory graph shows increase of cache and buffers after backup.  Then I just download backup files and delete them. After deletion Munin's memory graph returns cache and buffers to the state that was before backup.  Here's Munin graph:  Externally hosted image was a dead link. How to export and import mysql database with its data using php script? How to check if a process is running via a batch script Can I sign up to a Windows 10 free upgrade now and defer the actual install until after the July 29 deadline? Why and how do "bigger pixels" make a better picture? This is going off of today's iPhone 5S announcement, when Phil Schiller said that "bigger pixels" is the key to a better picture.      What does this mean? Is it true or just a marketing ploy? Taylor Expansion $\log(\frac{1+z}{1-z})$ Taylor Expansion of $\log(\frac{1+z}{1-z})$ around $z=0$  But $\log(1+z)=\sum_{n=1}^{\infty}(-1)^{n+1}\frac{z^n}{n}$  How can I continue from here? What and with what was Luthor doing in the ship at the end of the movie? After Doomsday was defeated, a spec-ops team sent to the Kryptionian ship in Metropolis found Luthor submerged in water, in front of a... thing, which "held" three metal cubes. The thing looked up, roars, and dissipates into thin air.    What the hell was that all about? I am really confused. What was that creature and what was Luthor doing with it?