for loop with enum in C++
How can I iterate over an enum?
Sum of independent Gamma distributions is a Gamma distribution If $X\sim \Gamma(a_1,b)$ and $Y \sim \Gamma(a_2,b)$, I need to prove $X+Y\sim\Gamma(a_1+a_2,b)$ if $X$ and $Y$ are independent. I am trying to apply formula for independence integral and just trying to multiply the gamma function but stuck ? Change default shell for Terminator My Command is below and its print Free CPU and Used CPU below format.  I want to restrict awk output to 2 decimal place.  grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} {free=($5)*100/($2+$3+$4+$5)} END {print "Used Cpu:",usage "%"} {print "Free Cpu:",free "%"}'   Output :   Free Cpu: 98.9588%  Used Cpu: 1.04125%   Desired output :  Free Cpu: 98.95%  Used Cpu: 1.04% Why is (sizeof(int) > -1) false? When you earn one tag badge, and then don't click "Track the next one" in the tag badge progress tracking box for a while, and then earn a second tag badge, that box continues to show "Congratulations, you earned [the same badge as before]", rather than updating to show that you've actually earned another tag badge since then.  For instance, right now  looks like this:    Even though I  a few weeks ago and then  yesterday, my profile hasn't updated to show the new achievement.  I also didn't get the "cipher" tag badge until after the 3am watershed, even though tag badges usually appear as soon as I visit my profile after earning them (for instance, I earned the "tags" tag badge on meta.SFF.SE today the very instant I clicked on my own profile there after having become eligible for the badge). Even when I went to look at the list of my progress towards different tag badges on Puzzling, which I thought would jog the system into realising I'd actually earned the badge, "cipher" still showed up as 99/100 score even after I'd gone well past 100, until last night when the badge was finally awarded and "cipher" disappeared from my list of badges to track.  TL;DR: if I don't click "Track the next one", my tag badges update slower than they should.  It's a very unimportant bug, but there must be more people than just me who like to see the "Congratulations" thing there for a while and rest on their laurels before moving on to track their progress towards the next milestone. how to stop firing oncomplete if save action has errors My requirement is to stop oncomplete call if save action has errors. I know I am doing some silly mistake.   Here I am unable to stop calling oncomplete function.  Requirement is, from VFP save method, data will get saved and then perform callout from oncomplete function. If there are any errors during save then stop making callouts.  Visualforce  &lt;apex:page id="hasErrorTestPage" controller="ErrorMessageFinder"  showHeader="false"&gt;     &lt;apex:pageMessages id="msgId"/&gt;     &lt;script&gt;         function performCallOutMethod()         {             var msg = document.getElementById('{!$Component.MSEForm.errorMsgInd}').value;             alert(msg);              if(msg == 'false' || typeof(msg) == 'undefined')             {                 alert('entering callout')                 performCallOut();                 return true;             }             else             {                 return false;             }         }     &lt;/script&gt;     &lt;apex:form id="MSEForm"&gt;         &lt;apex:actionFunction name="performCallOut" action="{!submit}" reRender="panelId,msgId"/&gt;          &lt;apex:outputPanel id="panelId"&gt;             &lt;apex:outputText value="{!hasError}" id="errorMsgInd"/&gt;         &lt;/apex:outputPanel&gt;         &lt;apex:inputText id="customerNm" value="{!CustomerName}"/&gt;&lt;br/&gt;         &lt;apex:commandButton value="Save" action="{!save}"                       oncomplete="return performCallOutMethod();" reRender="panelId,msgId"/&gt;     &lt;/apex:form&gt; &lt;/apex:page&gt;   Controller  public class ErrorMessageFinder {     public String CustomerName {get;set;}      public Boolean hasError {          get {              return ApexPages.hasMessages();          }            }      public PageReference save()     {            if(String.isBlank(CustomerName))         {             ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Error, 'Name cannot be null');             ApexPages.addMessage(msg);             return null;         }         return null;      }       public PageReference submit()     {         try         {   //navigate to view page             PageReference pg = new PageReference('/'+ '0019000001UwnVS');             pg.setRedirect(true);             return pg;         }         catch (Exception ex)         {             System.debug('Error in submit ' + ex);             ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Error, ex.getMessage());             ApexPages.addMessage(msg);              return null;         }     } }   Based on this code, if I hit save button without entering CustomerName then it is not showing error after save. It is showing error during oncomplete call and then navigating to view page, which I do not want.  Any help is appreciated. I have put a compiled code so that anyone can try with this code. When speaking with my mother a couple of days ago, I read to her a message I was sending to my cousin on her behalf ending with: "... the birthday of your youngest." [implying her child]  She immediately leapt on this and said that as my cousin only had two children, the use of the superlative was not permitted and the comparative must be used instead: "... the birthday of your younger child."  She was adamant that this was a solid grammatical rule that she was taught throughout her education.  As a younger Briton, I have relatively little formal grammatical education to older people who were better taught in this regard, so I usually defer to her on grammatical rule knowledge.  Is she right?  Are superlatives not permitted when the domain of the object is only two?  To me it seems bizarre.  The minimum or maximum of any set does not only exist when there are different minima and maxima, or indeed something which is neither. Copy existing property from e.g. Properties window to a custom panel So if I have this custom panel in the 3D view, is there a way I can take a property from for example the properties window and paste it onto my panel below the "text" prop, without creating a new property?  The reason I do not want to create a new property is because I want them to share all data, such as values, keyframes, drivers etc.        bl_info = {     "name": "",     "description": "",     "author": "",     "version": (0, 0, 1),     "blender": (2, 70, 0),     "location": "",     "warning": "",      "wiki_url": "",     "tracker_url": "",     "category": "" }  import bpy  from bpy.props import (StringProperty,                        BoolProperty,                        IntProperty,                        FloatProperty,                        FloatVectorProperty,                        EnumProperty,                        PointerProperty,                        ) from bpy.types import (Panel,                        Operator,                        AddonPreferences,                        PropertyGroup,                        )   class inouse_Settings(PropertyGroup):      my_bool = BoolProperty(         name="Enable or Disable",         description="A bool property",         default = False)     class UV_OT_my_panel(Panel):     bl_space_type = 'VIEW_3D'     bl_idname = "UV_OT_my_panel"     bl_label = "Custom"     bl_category = "Custom"     bl_region_type = 'TOOLS'      def draw(self, context):          scn = context.scene         mytool = scn.inhouse         layout = self.layout          col = layout.column(align=True)         row = col.row(align = True)         row.prop(mytool, "my_bool", text="Text")       def register():     bpy.utils.register_module(__name__)     bpy.types.Scene.inhouse = PointerProperty(type=inouse_Settings)  def unregister():     bpy.utils.unregister_module(__name__)     del bpy.types.Scene.inhouse  if __name__ == "__main__":     register() Answer draft is lost if you click to sign up When writing an answer on a site where you don't have an account or are not logged in, below the answer entry textbox are options to create an account or continue as guest by providing a nickname and email. I had written an answer of several paragraphs on a network site, clicked &quot;Sign up with Google&quot; (resulting in association to my existing network-wide profile) but after doing so instead of showing my answer to be posted, only the first five or six words were retained.  I know that I had no account on this site previously because I just received the association bonus... I cannot tell whether the bug also affects totally new users or those with accounts but who are not logged in. This is a very unwelcoming user experience.  Please fix it. If the intended workflow is to click &quot;Post Answer&quot; first and associate the account afterwards, then the sign up options should not be shown until the answer is posted, and certainly not above the Post Answer button. This problem also occurs if you already have an account on the site, and click 'sign up with google' (which allows you to successfully log in). Some of you might insist that it was not a murder, as we know that a rebounding spell had hit Ariana, as shown in .  However, a death in such a well known family would not go uninvestigated, I presume. Were the Dumbledore brothers investigated? How did they get away with their sister suddenly dropping dead?  I'd think that Ministry of Magic has means to recognize a death caused by magical means. That's how we know that Tom Riddle Snr. was killed by Avada Kedavra. So Ariana's failing health might be a poor excuse. Was Severus Snape made a Death Eater before or after he told Voldemort about the Prophecy? Based on discussion in comments on , was Severus Snape a Death Eater (real one, with Dark Mark) before he overheard Sybil give the Prophecy to Dumbledore and relayed it to Voldemort? Or was he made a DE after that?  Canon sources only please (books/interviews/Pottermore) How to show that Klein four-group is a normal subgroup of the alternating group $A_4$ I downloaded the iso file for XUbuntu. I created a live usb using Pen Drive Linux. I turned on my computer, booted to the XUbuntu installation screen, and selected "check disk for defects".  A minute later, it says that it found one defect. How do I figure out what this defect is? Why does my object not show up? This is meant to solve this problem once and for all. What is every reason an object isn't showing up in a render or viewport in when using the cycles render engine? Why is "be" here? People be like Repeat String - Javascript I have some thoughts on this. First, I want to say I am no expert on cryptography, I just know some stuff, and I took a cryptography class in University. I am very interested in this topic.  I understand that many security experts out there might get angry just by the discussion of these things, but I hope you can spare me :)  My Questions:  Would it be possible to break an RSA key, in for example 1 week of time, if the cracker have already spent X number of years building an index of primes by performing every permutation of existing prime keys up to 2^2048 ?  I understand this would take an immense amount of time to do, but it would only be done once.  Given the public key, you would be able to look up what the two primes are, and hence retrieve the private key instantly.  When I consider who might break such a code, I am primarily thinking about NSA and other Governments that might have spent years in research and have the resources and interest in doing so.  Breaking an 256 AES would then be easier, as AES keys are often generated using the RSA private key.  Would it be possible to build such an index ? How long would that take in permutations, and perhaps with the fastest computer in the world ?  I hope we can have a nice chat about this. We are just discussion theory here. I hope you can offer me some insight on this topic.  Thanks! Easy way to remap non-modifier keys on Mac? I want to remap § to ` and ± to ~ on my Mac keyboard because they are located in a place I am not used to. Is there an easy way to do this? How to get exact camera view? I'm currently a beginner when it comes to 3D modelling but doing okay so far. I'm struggling a bit when it comes to the final renders of my scene, specifically on the camera view I want. Sometimes its to zoomed in and sometimes to zoomed out that it's gone out of the environment of the blender. I realized the settings for the camera on blender are for actual cameras / photography and I'm no expert on that too. A tip on how to control them precisely would be nice. Thank you. How to restore Windows 7 MBR without a CD I have been playing with Ubuntu for a few weeks now, and I'd like to revert my computer back to it's original - factory - defaults.   On the computer I have a recovery partition (it's a netbook). I went through the process of recovery and everything seemed fine. However, when I restart the computer I'm presented with   grub rescue &gt;   Now, my understanding is that when I installed Ubuntu "side by side" it replaced the MBR or something like it, with GRUB.   I've read on a slew of forums, that I need to use a Windows Recovery Disk.   Here are my issues:   a) I don't have a recovery disk, I have a recovery partition - it's a netbook. b) I don't have an external cd drive.   What I do have is a USB key that has about 1gb of space on it.   Thanks in advance.