try/finally without catch and return value
Does a finally block always get executed in Java?
What's a way to implement a flexible buff/debuff system? Overview:  Lots of games with RPG-like statistics allow for character "buffs", ranging from simple "Deal 25% extra damage" to more complicated things like "Deal 15 damage back to attackers when hit."  The specifics of each type of buff aren't really relevant.  I'm looking for a (presumably object-oriented) way to handle arbitrary buffs.  Details:  In my particular case, I have multiple characters in a turn-based battle environment, so I envisioned buffs being tied to events like "OnTurnStart", "OnReceiveDamage", etc.  Perhaps each buff is a subclass of a main Buff abstract class, where only the relevant events are overloaded.  Then each character could have a vector of buffs currently applied.  Does this solution make sense?  I can certainly see dozens of event types being necessary, it feels like making a new subclass for each buff is overkill, and it doesn't seem to allow for any buff "interactions".  That is, if I wanted to implement a cap on damage boosts so that even if you had 10 different buffs which all give 25% extra damage, you only do 100% extra instead of 250% extra.  And there's more complicated situations that ideally I could control.  I'm sure everyone can come up with examples of how more sophisticated buffs can potentially interact with each other in a way that as a game developer I may not want.  As a relatively inexperienced C++ programmer (I generally have used C in embedded systems), I feel like my solution is simplistic and probably doesn't take full advantage of the object-oriented language.  Thoughts?  Has anyone here designed a fairly robust buff system before?  Edit: Regarding Answer(s):  I selected an answer primarily based on good detail and a solid answer to the question I asked, but reading the responses gave me some more insight.  Perhaps unsurprisingly, the different systems or tweaked systems seem to apply better to certain situations.  What system works best for my game will depend on the types, variance, and number of buffs I intend to be able to apply.  For a game like Diablo 3 (mentioned below), where nearly any bit of equipment can change a buff's strength, the buffs are just character stats system seems like a good idea whenever possible.  For the turn-based situation I'm in, the event-based approach may be more suitable.  In any case, I'm still hoping someone comes along with a fancy "OO" magic bullet which will allow for me to apply a +2 move distance per turn buff, a deal 50% of damage taken back to the attacker buff, and a automatically teleport to a nearby tile when attacked from 3 or more tiles away buff in a single system without turning a +5 strength buff into its own subclass.  I think the closest thing is the answer I marked, but the floor is still open.  Thanks to everyone for the input. Find $\sum_{n=1}^{\infty}$ $\frac{n^{2}}{\left(n+1\right)\left(n+2\right)\left(n+3\right)\left(n+4\right)}$ $$\sum_{n=1}^{\infty}\frac{n^{2}}{\left(n+1\right)\left(n+2\right)\left(n+3\right)\left(n+4\right)}$$   MY Approach$\sum_{n=1}^{\infty}$$\frac{n^{2}}{\left(n+1\right)\left(n+2\right)\left(n+3\right)\left(n+4\right)}$ = Lim$_{k\rightarrow\infty}$$\sum_{k=1}^{n}\frac{k^{2}}{\left(k+1\right)\left(k+2\right)\left(k+3\right)\left(k+4\right)}$  $\frac{k^{2}}{\left(k+1\right)\left(k+2\right)\left(k+3\right)\left(k+4\right)}$= $\frac{1}{6\left(n+1\right)}$-$\frac{2}{\left(n+2\right)}$+$\frac{9}{\left(n+3\right)2}$-$\frac{8}{\left(n+4\right)3}$  I don't think i can telescope it, And i don't know any other method How do I select all the columns in a table that only contain NULL values for all the rows?  I'm using MS SQL Server 2005.  I'm trying to find out which columns are not used in the table so I can delete them. I'm having troubles with rendering my datatable correctly. There are actions added but it seems the datatable is not high enough to view it correctly. Is it something I'm doing wrong? Or is it a bug?    This is the code for the datatable  &lt;div class="slds-text-heading_medium"&gt;Search results&lt;/div&gt; &lt;lightning:datatable data="{! v.persondata }"                      columns="{! v.personcolumns }"                      keyField="id"                     onrowselection="{! c.getSelectedPerson }"                     hideCheckboxColumn="true"  /&gt;   Here is the code for initializing the columns  //init datatable component.set('v.personcolumns', [             {label: 'Last Name', fieldName: 'LastName', type: 'text'},             {label: 'First Name', fieldName: 'FirstName', type: 'text'},             {label: 'Mailing Zip/ Postal Code', fieldName: 'PersonMailingPostalCode', type: 'text'},             {label: 'Mailing City', fieldName: 'PersonMailingCity', type: 'text'},             {label: 'Billing Street', fieldName: 'PersonMailingStreet', type: 'text'},             {label: 'Email', fieldName: 'PersonEmail', type: 'text'},             {label: 'Primary Phone', fieldName: 'PersonHomePhone', type: 'text'},             {label: 'Secondary Phone', fieldName: 'PersonOtherPhone', type: 'text'},             {type: 'action', typeAttributes: { rowActions: actions}}         ]);   And the code for adding data (the response is a list of Accounts)  component.set('v.persondata',response.getReturnValue()); Proving that $n$-cycle has order $n$ Two figures side by side How can I put two figures side-by-side? Not two sub-figures, but two actual figures with separate "Fig.: bla bla" captions.  A figure is supposed to spread over the entire text width, but I have two figures which are narrow and long, and I need to save the space in order to withstand the pages limit. a) Let $a&gt;0$ and the sequence $x_n$ fulfills $x_1&gt;0$ and $x_{n+1}=\frac{1}{2}(x_n + \frac{a}{x_n})$ for $n \in \mathbb N$. Show that $x_n \rightarrow \sqrt a$ when $n\rightarrow \infty$. I have done it in two ways, but I guess I'm not allowed to use the first one and the second one is incomplete. Can someone please help me?  We already know $x_n \rightarrow \sqrt a$, so we do another step of the iteration and see that $x_{n+1} = \sqrt a$.  Using limit, $x_n \rightarrow x, x_{n+1} \rightarrow x$ (this is the part I think it's incomplete, don't I have to show $x_{n+1} \rightarrow x$, how?), we have that   $$x = \frac x 2 (1 + \frac a {x^2}) \Rightarrow 1 = a/x^2 \Rightarrow x = \sqrt a$$ b) Let the sequence $x_n$ be defined as $x_{n+1}= 1 + \frac 1 {x_n} (n \in \mathbb N), x_1=1$. Show that it converges and calculate its limit. &quot;Tip: Show that sequences $x_{2n}$ and $x_{2n+1}$ monotone convergent to the limit.&quot; I didn't understand the tip, how can this help me? Does it make a difference if the number is odd or even? Thanks in advance! Given a logarithm is true, if and only if, $y = \log_b{x}$ and $b^y = x$ (and $x$ and $b$ are positive, and $b$ is not equal to $1$), are true, why aren't logarithms defined for negative numbers?  Why can't $b$ be negative? Take $(-2)^3 = -8$ for example. Turning that into a logarithm, we get $3 = \log_{(-2)}{(-8)}$ which is an invalid equation as $b$ and $x$ are not positive! Why is this? What is the difference between these two Breusch-Pagan Tests? Using R on some data and trying to see whether or not my data is heteroscedastic, I've found two implementations of the Breusch-Pagan test,  (package lmtest) and  (package car). However, these produce different results. What is the difference between the two? When should you choose to use one or the other?  &gt; model &lt;- lm(y ~ x) &gt; bp &lt;- bptest(model) &gt; bp studentized Breusch-Pagan test  data:  model  BP = 3.3596, df = 1, p-value = 0.06681  &gt; ncvTest(model) Non-constant Variance Score Test  Variance formula: ~ fitted.values  Chisquare = 3.858704    Df = 1     p = 0.04948855    These example shows that according to the tests, my data is in one case heteroscedastic and in the other case homoscedastic. I did find  so bptest might be studentized and ncvTest might not be, however, what does this mean then? Vertical line for the the right margin in Notepad++ Does anyone know if Notepad++ can display a vertical line on the right margin to indicated that the text will or will not fit on a printed page?  I have looked but I cannot find it.  Word wrap does work, but it wraps by my screen width, not by the width of a printed page. Fully transparent windows in Pygame? Is it possible to get a fully transparent window in Pygame (see the desktop through it)?  I've found how to create a window without a frame, but there doesn't seem to be any obvious way to make it transparent.  I'd be willing to tie into system-specific technology/frameworks as long as there are solutions for both Windows and Mac OS X, but I'm not sure which direction to be looking.  The only topic I was able to find , which isn't something I can do for this particular project (needs to be Pygame). Mankind prepares for a war with aliens by warring among itself I am looking for the title or author of a atory I read back in the 90's, no idea when it was written. The plot goes something like this: Humanity has gained access to space travel and sends 9 or 12 survey ships towards galactic center, only 1 returns with stories of an enemy so rapacious that humanity starts preparing for war. After a long time, the enemy hasn't shown up and people begin to doubt the need to keep building for war. The government engineers a plan to turn the core systems against the fringe worlds and start warring amongst ourselves so that we may be prepared for when the real enemy shows up.  Written with the focus on one spaceship captain battling in our own internal war. For what values of $\theta$ does $\sum_{1}^{\infty} \frac{e^{i n\theta}}{n}$ Converge? I just came across the problem of what happens in the boundary cases of .  More concisely, for what $\theta$ will the following sum converge? $$\sum_{n=1}^{\infty} \frac{e^{ni\theta}}{n}$$ It is well known that this sum will diverge for $\theta=0$ and will converge for $\theta=\pi$. In fact, for any odd multiple of an even root of unity, since we have symmetry, for each line through the origin of the complex plane, we can use the alternating series theorem to show that they converge.  Another idea I had was to split  the sum into imaginary and real parts, and if we can prove each of these converges, then we are all set. So now we must prove that both of the following converge $$\sum_{n=1}^{\infty}\frac{\cos(n\theta)}{n}\space, \space \sum_{n=1}^{\infty}\frac{\sin(n\theta)}{n}$$ Now these can be shown to converge easily by Dirichlet's test for any rational multiple of pi, but what about irrational multiples of pi? I know it has been shown to converge with $\theta=1$, but I don't see how to generalize this. Get list of ALL offers from Amazon Product Advertising API One of the achievements for the Thieves Guild says "Restore the Thieves Guild to its former glory."  Brynjolf doesn't say anything to me, I can't seem to find Karliah, and as far as I can tell, I am finished with the plotline quests for the Thieves Guild. All I have left available are repeatable quests from Vex and Delvin.  How can I get this achievement? What does `:-` mean in a shell script I saw this in the end of an awesome shell script but I can't understand the login here because I think it's being short-handed for a longer command.  spark ${@:-`cat`}   This apears at the end of . Any ideas?  + Marks for some one who extends it into a full segment of code, even if its slower (Better for explanation) How to get method parameter names? Given the Python function:  def a_method(arg1, arg2):     pass   How can I extract the number and names of the arguments. I.e., given that I have a reference to func, I want the func.[something] to return ("arg1", "arg2").  The usage scenario for this is that I have a decorator, and I wish to use the method arguments in the same order that they appear for the actual function as a key. I.e., how would the decorator look that printed "a,b" when I call a_method("a", "b")? I have got this problem on limits  $$ \lim_{x \rightarrow 0}\left(\frac{\sin(x)}{x}\right)^\frac{1}{x^2}$$ What I am doing here is that taking log and then applying L-Hospital's Rule $$y= \lim_{x \rightarrow 0}\left(\frac{\sin(x)}{x}\right)^\frac{1}{x^2} $$ then $$\ln(y)=\lim_{x \rightarrow 0} \frac{1}{x^2}\ln\left(\frac{\sin(x)}{x}\right)$$ now it becomes $\frac{0}{0}$ type , but problem is how to take derivative here? when differentiating $\ln\left(\frac{\sin(x)}{x}\right)$ it will become $\frac{x}{\sin(x)}$ then we'll have to differentiate one more time like we do in case of $f(f(x))$ ? $\sin(x)$ and $x$ will be separately differentiated or together ? I'm making a door with piston sliding sideways that reacts to pressure plates. As the pressure plates are sending the current to redstone at a very low level, I need to raise it somehow, and this leads to awkward stairs of redstone.    So I'm wondering whether there are better ways of sending the redstone current up, maybe even vertically. What does "Could not find or load main class" mean?