I have a 3D matrix filled with "empty space" where I put some objects (objects are represented as bunch of occupied space).  The bullet is fired from coordinates (x1,y1,z1) at angles (verticalAngle,horizontalAngle).  How do I find the first coordinates in the bullet's trajectory line which is not market as "empty space"?  I suppose I'd have to loop through all the coordinates in that line till I find the not empty one (or the end of the matrix). But how do I calculate what are those coordinates that I have to go through?    When firing a bullet in 2D space I suppose this would be calculated as y = cos(angle) * x + startPosition where I'd increment x (in a for loop) to get y and check (x,y) cell for objects or "empty". Actually I'd have to increment y in the for loop to get x instead in case the trajectory line is closer to y-axis than x-axis.  But can someone help me with doing this in 3D space?  EDIT: Well I found this formula: (x,y,z)=(x0,y0,z0)+t(a,b,c) where (x0,y0,z0) are starting points and (a,b,c) direction factors, so I think I could increment t in a loop to get the coordinates.
I am developing a game with a Minecraft-like terrain made out of blocks. Since basic rendering and chunk loading is done now, I want to implement block selecting.  Therefore I need to find out what block the first person camera is facing. I already heard of unprojecting the whole scene but I decided against that because it sounds hacky and isn't accurate. Maybe I could somehow cast a ray in view direction but I do not know how to check the collision with a block in my voxel data. Of course this calculations must be done on the CPU since I need the results to perform game logic operations.  So how could I find out which block is in front of the camera? If it is preferable, how could I cast a ray and check collisions?
Resize Move Partitions on Dual Boot System I would like to be able to adjust the partitions shown below. Specifically, I want to add an additional 10GB from the unallocated space to /dev/sda5 (Ubuntu install). I will then format the remaining unallocated space as NTFS so it can be shared data between Windows and Ubuntu.   I am unable to increase the size of /dev/sda5 - I am only able to shrink it.  Any assistance would be greately appreciated. House wiring and grounding. How do you retrofit an old house and ground it? A contractor looked at our house and told me that you can't fix a house (with old wiring) that has some outlets that are not grounded.  He said that you can go on YouTube and search the internet and it will tell you that you can.  He says that the only way to properly fix and ground everything is to do a whole house rewire.  Is he correct?  If, theoretically, you have an old house that has no ground whatsoever, can you run a grounding wire from the panel to all of the outlets to fix this?  updated  We have BX/AC wiring. And also apparently we have "...old-style AC (BX) with cloth insulated wires in a paper overall wrap under the spiral armor (no bonding tape)" Courtesy of @ThreePhaseEel. SSL password on apache2 restart I setup wildcard SSL certificate from Godaddy on Apache2. Whenever the server restarts it asks for the passphrase for the SSL certificate's private key.    What's the best way to remove this obstacle to restarts, because when logfile rotation restart occurs in the middle of the night, the server doesn't come back up, and I get an unhappy client call in the morning, as it is a shared server. This is a very basic query I can't figure out....  Let's say I have a two column table like this:  userid  |  roleid --------|--------    1    |    1    1    |    2    1    |    3    2    |    1   I want to get all distinct userids that have roleids 1, 2 AND 3.  Using the above example, the only result I want returned is userid 1.  How do I do this? How can I calculate $24^{33} \bmod 80$ How can I calculate $24^{33} \mod 80$. I don't see how to start. I only know that $\phi (80) = 32$. A hint would suffice, thanks! How do you use the Dungeon Defender's Portal Gun? The topic pretty much sums up my question. I have not yet figured out how the gun operates aside from the fact that it creates Portal portals. The weapon description indicates that it deals 250+ base damage, but how is that damage applied to the monsters? Prove that a topological space equipped with a delta-complex structure is Hausdorff Proving at least 99 pairwise sums of the reals are non-negative Suppose, one hundred real numbers are given and their sum is 0.Then how can I prove that at least 99 of the pairwise sums of these hundred numbers are non-negative?  I tried this: Let the real numbers be $a_i$,$1\leq i\leq100$. By the given condition, $a_1+a_2+\dots +a_{100}=0$.Suppose for the sake of contradiction, that at most 98 of the pairwise sums of these given reals are non-negative.I just tried to examine the case when exactly 98 of them are non-negative. I labelled the sums $S_1$,$S_2,\dots S_{4950}$,WLOG assume that sums $S_1,S_2,\dots S_{4852}$ are negative, the rest are non-negative. $$S_1+S_2+\dots +S_{4950}=99(\sum_{i=1}^na_i)=0$$ Case I: $S_{4853}+a_{4854}+\dots +a_{4950}=0$.That simply means that $S_1+S_2+\dots +S_{4852}=0$.But, by the given condition, $S_1+S_2+\dots +S_{4852}&lt;0$,a contradiction.After that, I am not able to make any progress.  Can anyone please suggest a more efficient method to solve this problem.I feel this approach will involve enormous case work. Java - Screen turns black, when setting a JFrame to Fullscreen Today in the feed on the Android Stack Exchange app there is a Stack Overflow blog post. This post had the site icon next to it for  rather than the proper site logo (Meta).        Stack Exchange Android App Version 1.0.73 and 1.0.74 Android 5.1 on a Moto X (2013) running stock firmware.  Same behavior on a Nexus 7 (flo) running Android 6.0 (stock).  This issue also happens on the iOS app.    The most recent featured SO blog post (as of 17 Nov) is showing up with the "edX" site logo.  The logo is seemingly randomly incorrect. Natbib puts reference data one line per item I'm using:  \documentclass[oneside,article,openbib,12pt,titlepage]{memoir} \usepackage[authoryear,round]{natbib} % Better bibliography support \bibpunct{(}{)}{,}{a}{,}{,}   in the preamble of my document and  \backmatter \renewcommand{\bibname}{References} \bibliographystyle{chicago}    \bibliography{listb,mybib}   in the body of the file. But a typical formatted reference is:     Freely, I. (1997).   A small paper.   The journal of small papers -1. to appear.   I've tried other non-natbib styles (e.g., regstud), and the reference flows and wraps as it should. So how does one get natbib to do the same?  Also, how does one get natbib to include the authors' entire first names? How to match all occurrences of a regex In a casual search of the web, I found a few indications English does not allow zero copulas ().  However, I frequently see sentences with subordinate clauses that juxtapose a noun phrase with an adverb phrase, such as the following from a contemporary sci-fi author:  Kai stares up at me from the grave, his eyes hard as obsidian.  If this clause were made into a sentence, it would take an obligatory verb:  *His eyes hard as obsidian.  His eyes are hard as obsidian.  The original clause seems to contain an implicit "to be."  Is it an example of a zero copula?  If not, what is this construction called? I noticed with the holiday patch that there are new trees and shrubs that spawn on my land.  One popped up today, being specifically an X-Mas tree - which costs 25,000 gold to remove.   Is there any benefit to removing this X-Mas tree?  Is there any benefit to leaving it there?    It is noticeably the most expensive obstacle to remove yet. How to randomize (shuffle) a JavaScript array? I learned thermodynamics and the basics of statistical mechanics but I'd like to sit through a good advanced book/books. Mainly I just want it to be thorough and to include all the math. And of course, it's always good to give as much intuition about the material.  Some things I'd be happy if it includes (but again, it mostly just needs to be a clear book even if it doesn't contain these) are:   As much justifications for the postulates if possible, I'm very interested in reading more about how Liouville's theorem connects to the postulates. Have examples of calculating partition functions, hopefully not just the partition function for the ideal gas. E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) How does $e^{i x}$ produce rotation around the imaginary unit circle? Euler’s formula states that $e^{i  x} = \cos(x) + i \sin(x)$.  I can see from the MacLaurin Expansion that this is indeed true; however, I don’t intuitively understand how raising $e$ to the power of $ix$ produces rotation.  Can anyone give me an intuitive understanding? Canonical replacing Unity with gnome-shell in Ubuntu 18.04 what now? The default desktop environment in Ubuntu 18.04 is going to be gnome-shell instead of Unity 8.  Does this mean development of Unity is stopped? or just that we can expect it to be beta a bit longer?  source on  post by Mark Shuttleworth. phoronix also posted about it  and here about the Why are Icon Overlays (from 3rdParty-Apps) not showing up in the Win8 Explorer?