I kind of stucking at my current plattformer protoype for learning the component based entity system pattern.   I have CollisionComponent and a CollisionSystem. The CollisionSystem checks every frame all entities with CollisionComponents for intersection. Then it marks inside the CollisionComponent the entities which are colliding with this entity. So if an entity A collides with Entity B then they both have a the other as a reference inside their CollisionComponent as data.   This works absolutely fine and I can tell which entity is colliding with something/someone.  Now I have the problem how to use this information properly. I have a MovementSystem and it moves entities with a MovementComponent based on the velocity and the acceleration.   Who is now responsible for NOT moving a entity or do something else on a collision. Should the MovementSystem check if the entity has a CollisionComponent and if there is one, should the MovementSystem handle the NOT movement?  Let's say I have this situation. I have an entity (player) with a MovementComponent and a velocity to the right (because the player presses the right arrow) and the usual downwards velocity due of gravity influences. The player entity collides with another entity. A GroundComponent entity. Now which system should put entity A (the player) upwards so that he does not colliding with the ground anymore? The MovementSystem? At the same time, the player entity collides with another entity, an enemy. Which system should now handle the damage, or the knockback or whatever that enemy does to a player unit?  I really like the CBES but it really does not get into my mind how everything glues together.   I want to threat the components as pure data, so no logic in there (besides of ScriptComponents, but this is another type of problem)  Now my question is, which system handles which cases and how to treat passes of system (e.g. Movement pass one then the other systems then movement pass 2 and so on? How many systems do I really need and should a system only handle one type of problem? MovementSystem -> pure movement no matter what. CollisionSystem -> pure collision registration no matter what, DamageSystem -> damage handling based on component data
Trying to wrap my head around the ways to properly handle collision in a game designed around components.  I see many examples have some sort of PhysicsComponent that gets added to the entity's list of components but the actual implementation is confusing me.  For this to work, the PhysicsComponent would need access to the world around it. This doesn't make intuitive sense to me. Shouldn't a component be unaware of not only its container (the entity), but its container's container (the world)?  To me, it sounds like the level or scene should maintain a list of these entities and every game update, loop through the entities to determine which collide.  My question is firstly, whether or not this is good design, and secondly, how to determine which entities can collide. I suppose solid entities could implement an empty IRigidBody interface so the level could determine which entities in the list support collision. But is this breaking the component design?  Instead, should they contain an empty RigidBody component? This may actually be better because it may not always be empty and this approach is more future-proof. The only problem with this is the complexity. The scene would have to loop through not only every entity, but also every entity's components to determine if it had this RigidBody component.  Thirdly, when they do collide both entities should be informed somehow and I am unsure on how to accomplish this either.  Let's say that both entities contained a HealthComponent and when they collided both their healths would be decreased by some arbitrary value, 5. I suppose it would be the scene's responsibility to handle this when it detects a collision between two entities?  But then is the scene responsible for too much? I could see this possibly getting out of hand and becoming unwieldy when the scene is responsible for many things entities should not (?) have access to.  Edit: Question updated with more details.
/usr/bin vs /usr/local/bin on Linux Finding $\int_0^\infty \frac{\cos(ax)-\cos(bx)}{x}dx$ I am practicing calculus section of GRE Math Subject test, and I can't figure out a way to do the following integral: $$\int_0^\infty \frac{\cos (ax) - \cos (bx)}{x}dx.$$  I absolutely have no clue how to do this. Can someone show me the solution explicitly? Thank you. I updated the image in my Gravatar but my old picture still shows up.  Is this a cache issue?  Do I need to log out and then log back in? The  tag doesn't appear to be very useful.  It's used in a variety of ways (for reading, writing, showing, transforming, compiling, translating, obfuscating, obtaining, ... source code) on 1747 questions right now, and doesn't appear to be adding any classification value to the site.  Can we get rid of it? I am trying to make a histogram with the fitted curve plotted on it. Here's the mwe:   \documentclass[a4paper]{scrartcl}     \usepackage{tikz}     \usepackage{pgfplots,pgfplotstable}     \usepackage{filecontents}     \pgfplotsset{compat=1.10}     \usepackage[active,tightpage]{preview}     \setlength\PreviewBorder{2pt}     \newcommand{\plots}{0.611201}     \newcommand{\plotm}{2.19882}     \begin{filecontents}{data.dat}     2 0.0629921259843     3 0.0236220472441     4 0.0314960629921     5 0.125984251969     6 0.0629921259843     7 0.102362204724     8 0.110236220472     9 0.0551181102362     10 0.0629921259843     11 0.0314960629921     12 0.0236220472441     13 0.0314960629921     14 0.0629921259843     15 0.0551181102362     16 0.0393700787402     17 0.0472440944882     18 0.00787401574803     19 0.0393700787402     24 0.00787401574803     27 0.00787401574803     33 0.00787401574803     \end{filecontents}     \begin{document}     \begin{preview}      \begin{tikzpicture}     \begin{axis}[     yticklabel style={/pgf/number format/fixed},     scaled y ticks = false,     minor y tick num={1},     xtick pos=left,     legend cell align = left,     legend style={draw=none},     xlabel = {group size},     ylabel = {ratio}     ]     \addplot[blue,ybar,fill, fill opacity=0.3, bar width = 0.8,] table {data.dat};     \addplot[red, line width = 1,domain=1:40,samples=100] {1/(x*sqrt(2*pi)*\plots)*exp(-(ln(x)-\plotm)^2/(2*\plots^2))};     \legend{empirical,lognormal fit}     \end{axis}     \end{tikzpicture}     \end{preview}     \end{document}     As you can see, the legend is not really good. How can I change the legend so it looks more like this? Javascript close alert box I want to be able to close an alert box automatically using Javascript after a certain amount of time or on a specific event (i.e. onkeypress).  From my research, it doesn't look like that's possible with the built-in alert() function.  Is there a way to override it and have control over the dialog box that it opens?  Also, I don't want an override that shows a hidden div as the alert.  I need an actual dialog box. The Windows 10 April 2018 Update includes a new feature called Timeline which tacks the activities and allows you to see what you have done earlier, sends it to Microsoft servers, so that you can resume work on a 2nd device, which is connected to the same Microsoft account when you press the Tasks View button in the taskbar:    How can I disable the Timeline because I don't want that my activity gets tracked? How to get the path of a running JAR file? My code runs inside a JAR file, say foo.jar, and I need to know, in the code, in which folder the running foo.jar is.  So, if foo.jar is in C:\FOO\, I want to get that path no matter what my current working directory is. import Excel sheets by name Equal standard errors for all levels of a categorical factor in lmer I have a question about the standard error of mixed model parameters estimated using the lmerTest package.  I have 12 sites with 6 treatments over each site. I measured a response variable (biomass_of_insects) (which has a Gaussian distribution).   library (lmerTest)   model &lt;- lmer(biomass_of_insects ~ as.factor(treatments) + (1 | sites))   However, the model summary shows the same standard error for every treatment (see below: 114.065). Why is the standard error always the same?   Fixed effects:                                Estimate    Std.err      df       t        p (Intercept)             501.333     80.656  66.000   6.216 3.91e-08 *** as.factor(treat)F       126.667    114.065  66.000   1.110    0.271  as.factor(treat)I        -8.333    114.065  66.000  -0.073    0.942      as.factor(treat)I+F1/3  -75.000    114.065  66.000  -0.658    0.513    as.factor(treat)I+F2/3   18.333    114.065  66.000   0.161    0.873     as.factor(treat)I+F3/3   15.917    114.065  66.000   0.140    0.889 How to do relative imports in Python? Imagine this directory structure:  app/    __init__.py    sub1/       __init__.py       mod1.py    sub2/       __init__.py       mod2.py   I'm coding mod1, and I need to import something from mod2. How should I do it?    I tried from ..sub2 import mod2 but I'm getting an "Attempted relative import in non-package".  I googled around but found only "sys.path manipulation" hacks. Isn't there a clean way?      Edit: all my __init__.py's are currently empty    Edit2: I'm trying to do this because sub2 contains classes that are shared across sub packages (sub1, subX, etc.).  Edit3: The behaviour I'm looking for is the same as described in  (thanks John B) Powering a WS2812B strip Javascript custom button stopped working, Synchronous XMLHttpRequest is deprecated We have a custom javascript button on the quotes object in our org that has been working for several months that someone has noticed today is not working.    I'm not sure if there was an update that broke it or what day exactly it stopped working.  I'm hoping someone has an idea of where I can even begin to look.   Here's the code:   javascript:location.href= 'mailto:emailaddress@ourdomain.com?SUBJECT='+ escape("{!Quote.Name}")+' - '+ escape("{!Quote.Contact_s_Account__c}") + '&amp;BODY=Please convert ' + escape(location.href)+ ' into a proposal and send it to the email address on the quote.  Thanks!';   Using developer tools in chrome, I see this error after I click the javascript button:   presence: onFailure in event parser ={"status":-5,"statusText":""}page load happens value=true           umps1w4.salesforce.com/umps/UMPSWidget_184/js/dist/umps-min.js?cflag=184.36:14 presence: onFailure in event parser ={"status":-5,"statusText":""}page load happens value=true   I changed my code to something simple:   javascript:location.href= 'mailto:emailaddress@ourdomain.com?SUBJECT='hello'    and got this error in the developer tools in chrome:   Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.   This lead me to the conclusion that I'm having XSS issues.  I do remember a SF update not too long about about protecting against XSS issues.  I guess I'll have to figure out a different way to implement this functionality. divisibility of binomial coefficients by primes If $p$ is a prime number and $r = 1,2,3 \dots ,p -1$, how can I prove that the binomial coefficients $_nC_r(p,r)$ are divisible by $p$? By divisible I mean $_nC_r(p,r)/p$ leaves remainder $0$.  oivind traceroute TCP equivalent for Windows We know the escape velocity from the Earth is 11.2km/s. Isn't it the velocity required to escape from earth if we go normal to the surface of earth? i.e while we derive the formula for the escape velocity from earth we never consider the slanted motion of the object. So when we launch a rocket we need to use very less value of velocity compare to escape velocity to escape from earth because rocket follows a slanted path so curvature of earth has an effect?  If what I said above is right, then how we can say escape velocity is 11.2 km/s? Why do I get "unresolved external symbol" errors when using templates? When I write C++ code for a class using templates and split the code between a source (CPP) file and a header (H) file, I get a whole lot of "unresolved external symbol" errors when it comes to linking the final executible, despite the object file being correctly built and included in the linking.  What's happening here, and how can I fix it? Tourist Visa (30 days) Dubai valid until date Today I was informed by VFS that my tourist visa for UAE got approved. I'm travelling to UAE on 16th December 2014 and returning on 7th Jan 2015. But when I checked the "valid until" date on the visa it states 30 December 2014.    Does this date mean I should return before December 30th? Should I get it corrected from VFS? Is there a specific term for the association of certain verb(s) with certain nouns (as direct objects)? Or vice versa. Or perhaps a name for the pair itself?  For example:   hold an opinion make a complaint offer an apology   Also, where might I find a list of such pairs?    EDIT: I chose my title wording randomly. I have no idea whether 'cognate verb' is the correct term for these things. However, I've just found out that 'cognate objects' are a defined class in linguistics, so perhaps my choice of words was inappropriate. I'm going to leave the title as it is, anyway. "Welcome to the Jones__": Plural or Plural Possessive? When making a welcome sign, what form of the name Jones would you use?  ("Welcome to the Jones__")